:root {
  --sw: 230px;
  --pr: #2563eb;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sw);
  height: 100vh;
  background: #0f172a;
  color: #fff;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 20px 16px 10px;
  border-bottom: 1px solid #1e293b;
}

.sidebar .brand h5 {
  margin: 0;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.sidebar .brand small {
  color: #94a3b8;
  font-size: .75rem;
}

.nav-section {
  padding: 8px 12px 2px;
  font-size: .65rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 6px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: .85rem;
  border-radius: 6px;
  margin: 1px 8px;
  transition: all .15s;
}

.sidebar a:hover,
.sidebar a.active {
  background: #1e3a5f;
  color: #fff;
}

.sidebar a i {
  font-size: 1rem;
  width: 18px;
}

/* Main content */
.main {
  margin-left: var(--sw);
  padding: 24px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h4 {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
}

.topbar .date {
  color: #64748b;
  font-size: .85rem;
}

/* Cards */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
}

.stat-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card h3 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 8px 0 2px;
  color: #0f172a;
}

.stat-card p {
  margin: 0;
  color: #64748b;
  font-size: .8rem;
}

/* Tables */
.table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
  overflow: hidden;
  margin-top: 20px;
}

.table-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-card .card-header h6 {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
}

.table th {
  font-size: .78rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-color: #f1f5f9 !important;
  background: #f8fafc;
}

.table td {
  font-size: .87rem;
  vertical-align: middle;
  border-color: #f1f5f9 !important;
}

/* Status badges */
.badge-status,
.badge-priority {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  display: inline-block;
}

.status-new-order { background: #f0fdf4; color: #166534; }
.status-give-estimate { background: #fef3c7; color: #b45309; }
.status-waiting-for-approval { background: #fef9c3; color: #a16207; }
.status-order-part { background: #ede9fe; color: #6d28d9; }
.status-waiting-for-part { background: #fce7f3; color: #be185d; }
.status-waiting-for-repair { background: #ffedd5; color: #c2410c; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-in-progress { background: #dbeafe; color: #1e40af; }
.status-waiting-for-delivery { background: #e0f2fe; color: #0369a1; }
.status-ready { background: #d1fae5; color: #065f46; }
.status-complete { background: #bbf7d0; color: #14532d; }
.status-delivered { background: #e0e7ff; color: #3730a3; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-draft { background: #f1f5f9; color: #475569; }
.status-sent { background: #dbeafe; color: #1e40af; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-expired { background: #fef3c7; color: #92400e; }
.status-converted { background: #e0e7ff; color: #3730a3; }
.status-received { background: #d1fae5; color: #065f46; }

/* Priority badges */
.priority-high { background: #fee2e2; color: #991b1b; }
.priority-normal { background: #f0fdf4; color: #166534; }
.priority-low { background: #f8fafc; color: #475569; }

/* Forms */
.btn-primary { background: var(--pr); border-color: var(--pr); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.form-control:focus,
.form-select:focus { border-color: var(--pr); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

/* Flash messages */
.flash-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  min-width: 280px;
}

/* User footer in sidebar */
.sidebar-user {
  border-top: 1px solid #1e293b;
  padding: 12px 16px;
}

.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}

.sidebar-user .name {
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .role {
  color: #64748b;
  font-size: .7rem;
}

/* Print */
@media print {
  .sidebar, .topbar, .no-print, .flash-container { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.show { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; }
}

/* Turbo progress bar */
.turbo-progress-bar {
  background: var(--pr);
  height: 3px;
}
