* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:      #00aeef;
  --brand-dark: #077097;
  --brand-dim:  #0d8ab8;
  --brand-bg:   #e0f7ff;
  --brand-light:#f5fbff;
  --gray-bg:    #f8f6f3;
  --text:       #1f2937;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
  --white:      #fff;
  --shadow:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--gray-bg); color: var(--text); }

/* ── NAVBAR ── */
.navbar {
  background: linear-gradient(90deg, #006080 0%, var(--brand-dark) 40%, var(--brand) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 62px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 24px; }
.brand-name { font-size: 17px; font-weight: 700; color: #fff; line-height: 1.1; }
.brand-sub  { font-size: 11px; font-weight: 400; opacity: 0.85; display: block; }

.nav-links { display: flex; gap: 2px; }
.nav-links a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  padding: 8px 13px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.18s;
}
.nav-links a:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Navbar dropdown */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropbtn {
  color: rgba(255,255,255,0.88) !important;
  padding: 8px 13px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: inline-block;
  transition: background 0.18s;
  text-decoration: none;
}
.nav-dropdown:hover .nav-dropbtn,
.nav-dropbtn:hover { background: rgba(255,255,255,0.18); color: #fff !important; }
.nav-dropmenu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--brand-dark);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  min-width: 185px;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.nav-dropmenu a {
  display: block;
  padding: 10px 16px;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s;
}
.nav-dropmenu a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-dropdown:hover .nav-dropmenu { display: block; }

/* Nested submenu */
.nav-submenu-wrap { position: relative; }
.nav-submenu-btn {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; color: rgba(255,255,255,0.9);
  font-size: 14px; cursor: pointer; transition: background 0.15s;
  user-select: none;
}
.nav-submenu-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-submenu {
  display: none; position: absolute;
  top: 0; left: 100%;
  background: var(--brand-dark);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  min-width: 175px; z-index: 1001;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
.nav-submenu.open { display: block; }

.nav-user { display: flex; align-items: center; gap: 10px; }
.username { color: rgba(255,255,255,0.9); font-size: 14px; text-decoration: none; }
.username:hover { color: #fff; text-decoration: underline; }
.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.28); }

/* ── Hamburger button (hidden on desktop) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.18s;
}
.nav-hamburger:hover { background: rgba(255,255,255,0.15); }
.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
/* Animate to X when open */
.nav-open .nav-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-hamburger span:nth-child(2) { opacity: 0; }
.nav-open .nav-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile layout ── */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 0;
  }
  .nav-brand { flex: 1; }
  .nav-hamburger { display: flex; }

  /* Hide nav-links and nav-user by default on mobile */
  .nav-links,
  .nav-user {
    display: none;
    width: 100%;
  }

  /* Show when open */
  .nav-open .nav-links,
  .nav-open .nav-user {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 2px;
    padding: 8px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }
  .nav-links a,
  .nav-links .nav-dropbtn {
    display: block;
    padding: 10px 12px;
    font-size: 15px;
    border-radius: 6px;
  }

  /* Dropdowns open inline on mobile */
  .nav-dropdown { width: 100%; }
  .nav-dropdown:hover .nav-dropmenu { display: none; }
  .nav-dropmenu {
    position: static;
    box-shadow: none;
    border-radius: 0;
    border: none;
    background: rgba(0,0,0,0.15);
    margin-left: 12px;
  }
  .nav-dropmenu a { font-size: 14px; padding: 8px 14px; }

  .nav-user {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }
}

/* Role badges */
.role-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.role-administrator { background: #e53935; color: #fff; }
.role-lab           { background: var(--brand-dim); color: #fff; }
.role-sales         { background: #059669; color: #fff; }
.role-print         { background: #7c3aed; color: #fff; }

/* ── LAYOUT ── */
.main-content { padding: 24px; max-width: 1200px; margin: 0 auto; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { font-size: 22px; color: var(--brand-dark); font-weight: 700; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card h3 {
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand-bg);
  padding-bottom: 10px;
}
.card-header-flex { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.grand-total { font-size: 15px; color: #059669; font-weight: 600; }

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon  { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--brand-dark); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── QUICK ACTIONS ── */
.quick-actions { margin-top: 8px; }
.quick-actions h3 { font-size: 16px; color: var(--text-muted); margin-bottom: 12px; }
.action-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.action-card {
  background: var(--white);
  border: 2px solid var(--brand-bg);
  border-radius: 10px;
  padding: 16px 24px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-card:hover { border-color: var(--brand); background: var(--brand-bg); color: var(--brand-dark); }

/* ── WELCOME BANNER ── */
.welcome-banner {
  background: linear-gradient(135deg, var(--brand-bg), #c8efff);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--brand);
}

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border 0.2s;
  background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,174,239,0.12);
}
.form-full { grid-column: 1 / -1; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-full { width: 100%; padding: 12px; font-size: 16px; }
.btn-danger-sm {
  background: #e53935;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.btn-danger-sm:hover { background: #c62828; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  background: var(--brand-bg);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--brand);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover td { background: var(--brand-light); }
.empty { text-align: center; color: #aaa; padding: 30px; }

/* ── BADGES ── */
.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-pass    { background: #d1fae5; color: #065f46; }
.badge-fail    { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #e53935; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #059669; }

/* ── LOGIN PAGE ── */
.login-page {
  background: linear-gradient(135deg, #005c7a 0%, var(--brand-dark) 50%, var(--brand) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}
.login-logo { margin-bottom: 12px; }
.login-title    { font-size: 26px; font-weight: 700; color: var(--brand-dark); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.login-company-info { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.7; }
.login-company-info div { margin: 0; }
.nepali-date-login { margin-bottom: 20px; }
.login-form { text-align: left; margin-top: 20px; }
.login-form .form-group { margin-bottom: 16px; }
.login-footer { margin-top: 20px; font-size: 12px; color: #aaa; }

/* ── MISC ── */
.text-muted { color: var(--text-muted); font-size: 13px; }
.nepali-date-inline { font-size: 13px; color: var(--text-muted); }

/* ── Nepali Date Picker ── */
.ndp-wrap { display: block; }
.ndp-row { display: flex; align-items: flex-end; gap: 8px; }
.ndp-col { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.ndp-lbl { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.ndp-arrow { font-size: 18px; color: var(--brand); padding-bottom: 8px; user-select: none; flex-shrink: 0; }

.ndp-bs-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 6px;
  background: #fff; font-size: 14px; cursor: pointer;
  transition: border 0.2s, background 0.2s; width: 100%;
  text-align: left; color: var(--text); white-space: nowrap; overflow: hidden;
}
.ndp-bs-btn:hover, .ndp-bs-btn:focus { border-color: var(--brand); background: var(--brand-light); outline: none; }
.ndp-bs-text { overflow: hidden; text-overflow: ellipsis; }

.ndp-ad-in {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 14px; width: 100%; transition: border 0.2s;
}
.ndp-ad-in:focus { outline: none; border-color: var(--brand); }

.ndp-popup {
  position: absolute; z-index: 99999; background: #fff;
  border: 1px solid var(--brand-bg); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15); padding: 12px; width: 300px;
}
.ndp-ph { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 2px; }
.ndp-title { font-size: 14px; font-weight: 700; color: var(--brand-dark); flex: 1; text-align: center; }
.ndp-nav {
  background: none; border: 1px solid var(--brand-bg); border-radius: 5px;
  padding: 3px 7px; cursor: pointer; font-size: 13px; color: var(--brand);
  transition: background 0.15s; flex-shrink: 0;
}
.ndp-nav:hover { background: var(--brand-bg); }
.ndp-selrow { display: flex; gap: 6px; margin-bottom: 8px; }
.ndp-ysel, .ndp-msel { flex: 1; padding: 5px 4px; border: 1.5px solid var(--border); border-radius: 5px; font-size: 12px; cursor: pointer; min-width: 0; }
.ndp-ysel:focus, .ndp-msel:focus { outline: none; border-color: var(--brand); }
.ndp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 8px; }
.ndp-wh { text-align: center; font-size: 11px; font-weight: 700; color: var(--brand); padding: 3px 0; }
.ndp-d {
  background: none; border: 1px solid transparent; border-radius: 5px;
  padding: 3px 0; font-size: 12px; cursor: pointer; text-align: center; line-height: 1.2;
  color: var(--text); transition: background 0.12s;
  display: flex; flex-direction: column; align-items: center; width: 100%;
}
.ndp-d sub { font-size: 9px; color: #bbb; line-height: 1; }
.ndp-d:hover { background: var(--brand-bg); border-color: var(--brand); }
.ndp-d.ndp-tod { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.ndp-d.ndp-sel { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.ndp-d.ndp-sel sub { color: rgba(255,255,255,0.55); }
.ndp-d.ndp-sel:hover { background: var(--brand); }
.ndp-equiv { font-size: 12px; color: #666; text-align: center; padding: 6px 0 2px; border-top: 1px solid var(--brand-bg); }
.ndp-table-bs { font-size: 11px; color: var(--brand); margin-top: 2px; }
