:root {
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --sidebar-bg: #111827;
  --bg: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}
* {
  box-sizing: border-box;
  outline: none;
}

/* --- LOGIN SCREEN --- */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--sidebar-bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  padding: 40px;
  border-radius: 24px;
  width: 360px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.login-card img {
  width: 100%;
  max-width: 200px;
  margin-bottom: 25px;
  border-radius: 8px;
}
.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  cursor: pointer;
  color: var(--text-muted);
  justify-content: center;
}
.remember-me input {
  width: auto;
  margin: 0;
}

/* --- NAVIGATION --- */
.nav-rail {
  width: 80px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 0;
  gap: 15px;
  z-index: 10;
  flex-shrink: 0;
  transition: var(--transition);
}
.nav-rail.expanded {
  width: 240px;
  align-items: flex-start;
  padding-left: 20px;
}

.nav-toggle-btn {
  width: 100%;
  display: flex;
  justify-content: center;
  color: #6b7280;
  cursor: pointer;
  margin-bottom: 20px;
  transition: var(--transition);
}
.nav-toggle-btn:hover {
  color: white;
}
.nav-rail.expanded .nav-toggle-btn {
  justify-content: flex-end;
  padding-right: 15px;
}

.nav-item {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  color: #9ca3af;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.nav-rail.expanded .nav-item {
  width: 100%;
  justify-content: flex-start;
  padding-left: 12px;
  height: 44px;
}

.nav-icon {
  min-width: 24px;
  display: flex;
  justify-content: center;
}
.nav-text {
  opacity: 0;
  margin-left: 12px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
  display: none;
}
.nav-rail.expanded .nav-text {
  opacity: 1;
  display: block;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* --- SIDEBAR (SEARCH) --- */
.sidebar {
  width: 320px;
  background: white;
  border-right: 1px solid #e2e8f0;
  display: none;
  flex-direction: column;
  padding: 25px;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar.active {
  display: flex;
}

/* --- MAIN VIEWPORT --- */
.viewport {
  flex-grow: 1;
  overflow-y: auto;
  padding: 35px 40px;
  position: relative;
  scroll-behavior: smooth;
}

/* --- HEADER & USER PROFILE --- */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}
.dash-logo {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.user-profile-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 12px 6px 8px;
  border-radius: 10px;
  transition: var(--transition);
  background: white;
  border: 1px solid #e2e8f0;
}
.user-profile-box:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.user-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.85rem;
}
.user-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  width: 160px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: none;
  overflow: hidden;
  z-index: 100;
  animation: fadeIn 0.1s ease;
}
.user-dropdown.show {
  display: block;
}
.user-drop-item {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}
.user-drop-item:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* --- DASHBOARD METRICS (5 Columns) --- */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin-bottom: 30px;
}
.metric-card {
  background: white;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  text-align: center;
  transition: var(--transition);
}
.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.04);
}
.metric-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  display: block;
  line-height: 1.2;
  margin-bottom: 4px;
}
.metric-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

/* --- CARDS & LAYOUT --- */
.card {
  background: white;
  padding: 25px;
  border-radius: 20px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 2px 4px -1px rgba(0, 0, 0, 0.02);
  border: 1px solid #f1f5f9;
  margin-bottom: 25px;
  position: relative;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* --- DETAIL VIEW GRID --- */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
}
.detail-section {
  margin-bottom: 25px;
}
.detail-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #1e293b;
  transition: all 0.2s;
  margin-bottom: 0;
}
.detail-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

/* --- SIGNUP FORM STYLING --- */
.signup-container {
  max-width: 850px;
  margin: 0 auto;
}
.signup-container h2 {
  border-bottom: 2px solid #f3f4f6;
  padding-bottom: 10px;
  margin-bottom: 30px;
  font-size: 1.5rem;
  font-weight: 600;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin: 30px 0 15px 0;
  display: block;
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}
.hidden {
  display: none;
}
.input-group {
  margin-bottom: 15px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.full-width {
  grid-column: span 2;
}
.comm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
}
.check-item input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}
.radio-container {
  display: flex;
  gap: 10px;
}
.radio-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}
.radio-card input {
  width: auto;
  margin-right: 10px;
  cursor: pointer;
}
.radio-card:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}
.logic-panel {
  background: #f0f7ff;
  padding: 20px;
  border-radius: 12px;
  margin-top: 10px;
  border: 1px solid #dbeafe;
}
.discount-panel {
  background: #fffbeb;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #fef3c7;
  margin-bottom: 20px;
}
.summary-total {
  font-size: 18px;
  font-weight: 700;
  color: #60a5fa;
  margin-top: 10px;
}
.summary-note {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 10px;
  font-style: italic;
}
.breakdown-text {
  font-size: 11px;
  color: #9ca3af;
  display: inline;
  margin-left: 5px;
  font-weight: 400;
  font-style: normal;
}
.terms-box {
  margin-top: 25px;
  background: #fffbeb;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #fef3c7;
  font-size: 13px;
  color: #4b5563;
}
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 15px;
}
.checkbox-group input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-label {
  line-height: 1.4;
  font-size: 13px;
  font-weight: 400;
  color: #374151;
}
#success-page {
  text-align: center;
  padding: 40px 10px;
}
.success-icon {
  font-size: 64px;
  color: #10b981;
  margin-bottom: 20px;
}
.confirm-box {
  background: #f0fdf4;
  color: #166534;
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid #bbf7d0;
  font-size: 14px;
}

/* --- PENDING ORDERS (Single Line / Sleek) --- */
.pending-order-card {
  padding: 0 15px;
  height: 56px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 10px;
  margin-bottom: 8px;
  background: white;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pending-order-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
  transform: translateX(2px);
}

.order-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.order-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-badge {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  min-width: 90px;
  text-align: center;
  letter-spacing: 0.5px;
}
.stage-prio-low {
  background: var(--success-light);
  color: #065f46;
}
.stage-prio-med {
  background: #ffedd5;
  color: #9a3412;
}
.stage-prio-high {
  background: var(--danger-light);
  color: #991b1b;
}
.badge-healthy {
  background: var(--success-light);
  color: #065f46;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}

.date-box {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 12px;
  text-align: center;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 120px;
  white-space: nowrap;
}
/* Dynamic Date Colors */
.db-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
.db-orange {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.db-red {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-toggle-view {
  background: white;
  border: 1px solid #cbd5e1;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-toggle-view:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* --- BILLING TABLE (Modernized) --- */
.bill-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  margin-top: 5px;
}
.bill-table th {
  text-align: left;
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 20px 10px 20px;
  font-weight: 700;
}
.bill-table tbody tr {
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
  border-radius: 16px;
}
.bill-table tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.bill-table td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
.bill-table td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}
.bill-table td {
  padding: 18px 20px;
  font-size: 0.9rem;
  vertical-align: middle;
  border: none;
  color: var(--text-main);
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}
.bill-table td:first-child {
  border-left: 1px solid #f1f5f9;
}
.bill-table td:last-child {
  border-right: 1px solid #f1f5f9;
}

/* Payment Status Buttons */
.btn-status-due {
  cursor: pointer;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #991b1b;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: var(--transition);
  display: inline-block;
  width: 90px;
  text-align: center;
}
.btn-status-due:hover {
  background: #fecaca;
  transform: scale(1.05);
}

.btn-status-paid {
  cursor: pointer;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: var(--transition);
  display: inline-block;
  width: 90px;
  text-align: center;
}
.btn-status-paid:hover {
  background: #a7f3d0;
  transform: scale(1.05);
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}
.status-paid {
  background: #d1fae5;
  color: #065f46;
}
.status-unpaid {
  background: #fee2e2;
  color: #991b1b;
}

/* --- GENERAL COMPONENTS --- */
.dash-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.search-box {
  position: relative;
  margin-bottom: 15px;
}
.search-box input {
  padding-left: 40px;
  height: 45px;
  background: white;
  border: 1px solid #e2e8f0;
  transition: var(--transition);
  font-size: 0.9rem;
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 13px;
  color: #94a3b8;
  width: 18px;
}

.btn-add-main {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  transition: var(--transition);
  font-size: 0.95rem;
}
.btn-add-main:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.btn-sync {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.btn-sync:hover {
  background: var(--primary);
  color: white;
}

.customer-item {
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  background: white;
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}
.customer-item:hover {
  border-color: var(--primary);
}
.customer-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-family: inherit;
  margin-bottom: 15px;
  box-sizing: border-box;
  background: white;
  color: var(--text-main);
  font-size: 0.9rem;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  outline: none;
}
label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
  display: block;
  margin-bottom: 6px;
}

/* Activity Log */
.filters-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  background: white;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  align-items: center;
}
.activity-container {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}
.activity-container::-webkit-scrollbar {
  width: 6px;
}
.activity-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  z-index: 100;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}
.modal-box {
  background: white;
  padding: 35px;
  border-radius: 24px;
  width: 450px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.2s ease;
}

/* Stepper & Tabs */
.progress-container {
  position: relative;
  margin: 40px 0;
  padding: 0 10px;
}
.progress-line {
  position: absolute;
  top: 18px;
  left: 30px;
  right: 30px;
  height: 3px;
  background: #f1f5f9;
  z-index: 1;
}
.steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 70px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.step:hover {
  transform: translateY(-2px);
}
.icon-circle {
  width: 36px;
  height: 36px;
  background: white;
  border: 2px solid #f1f5f9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: var(--transition);
}
.step.prio-low .icon-circle {
  border-color: var(--success);
  color: var(--success);
}
.step.prio-med .icon-circle {
  border-color: var(--warning);
  color: var(--warning);
}
.step.prio-high .icon-circle {
  border-color: var(--danger);
  color: var(--danger);
  background: #fef2f2;
}

.tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  border-bottom: 2px solid #f1f5f9;
}
.tab-btn {
  padding: 10px 5px;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 600;
  color: #94a3b8;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-size: 0.95rem;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Alerts */
.note-entry {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  border-left: 4px solid #cbd5e1;
  background: white;
  border: 1px solid #f1f5f9;
  position: relative;
}
.note-high {
  border-left-color: var(--danger);
  background: #fff1f2;
  border-color: #fee2e2;
}
.note-med {
  border-left-color: var(--warning);
  background: #fffbeb;
  border-color: #fed7aa;
}
.note-low {
  border-left-color: #cbd5e1;
  background: #f8fafc;
}
.note-edit-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 0.7rem;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 700;
  text-decoration: underline;
}
.dismiss-btn {
  float: right;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1.2rem;
  line-height: 0.5;
}

.action-icon {
  color: #64748b;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}
.action-icon:hover {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
}
.btn-delete {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

.total-box {
  background: #1e293b;
  color: white;
  padding: 25px;
  border-radius: 16px;
  margin-top: 20px;
}
.summary-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.9rem;
  border-bottom: 1px solid #334155;
  padding-bottom: 8px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
