/* ═══════════════════════════════════════════
   OMS — Mobile-First Stylesheet
   ═══════════════════════════════════════════ */
:root {
  --sidebar-w:      240px;
  --topbar-h:       56px;
  --brand-green:    #1a7a4a;
  --sidebar-bg:     #1a1f2e;
  --sidebar-text:   #b8c0cc;
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-active: #1a7a4a;
}
*,*::before,*::after { box-sizing:border-box }
body { margin:0; font-family:'Segoe UI',system-ui,sans-serif; background:#f4f6f9; -webkit-tap-highlight-color:transparent; }

/* ── Sidebar ───────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  overflow: hidden;
  transition: transform .25s ease;
}
@media (max-width: 767.98px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
}
@media (min-width: 768px) {
  #sidebar { transform: translateX(0); transition: width .25s ease; }
  #sidebar.collapsed { width: 0; overflow: hidden; }
}

/* Backdrop (mobile only) */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 299;
}
#sidebar-backdrop.show { display: block; }

.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.25rem;
  font-size: 1.2rem; font-weight: 700; color: #fff;
  letter-spacing: .03em;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap; flex-shrink: 0;
  min-height: var(--topbar-h);
}
.sidebar-brand i { font-size: 1.3rem; color: #4ade80; }

.sidebar-menu {
  list-style: none; margin: .5rem 0; padding: 0;
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sidebar-menu .nav-section {
  font-size: .68rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: #5a6478;
  padding: 1rem 1.25rem .35rem; white-space: nowrap;
}
.sidebar-menu .nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none; font-size: .9rem;
  transition: background .15s, color .15s;
  white-space: nowrap;
  min-height: 44px;
}
.sidebar-menu .nav-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-menu .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar-menu .nav-link i { font-size: 1.1rem; min-width: 1.3rem; }

/* ── App wrapper ───────────────────────────── */
#app-wrapper {
  display: block;
  width: 100%;
  min-height: 100vh;
}

/* ── Main content ──────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .25s ease, width .25s ease;
}
#main-content.sidebar-collapsed {
  margin-left: 0;
  width: 100%;
}
@media (max-width: 767.98px) {
  #main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ── Top bar ────────────────────────────────── */
.top-bar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  display: flex; align-items: center;
  padding: 0 1rem; gap: .6rem;
  position: sticky; top: 0; z-index: 200;
}
.page-title { font-weight: 600; font-size: .9rem; color: #1a1f2e; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icon { background: none; border: none; padding: .4rem .5rem; color: #555; cursor: pointer; border-radius: 6px; min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: #f0f0f0; }

/* ── Content area ──────────────────────────── */
.content-area { padding: 1rem; flex: 1; overflow-x: hidden; }
@media (min-width: 768px) { .content-area { padding: 1.5rem; } }

/* ── Stat cards ────────────────────────────── */
.stat-card {
  background: #fff; border-radius: 12px;
  padding: 1rem 1.25rem; border: 1px solid #e8eaf0;
  display: flex; align-items: center; gap: .85rem;
}
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-card .stat-val   { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .75rem; color: #6c757d; margin-top: .2rem; }
.stat-green  { background: #e9f5ee; color: var(--brand-green); }
.stat-blue   { background: #e7f0fd; color: #1a56db; }
.stat-orange { background: #fff4e6; color: #c96a00; }
.stat-red    { background: #fde8e8; color: #c0392b; }
.stat-purple { background: #f0ecfd; color: #6741d9; }

/* ── Table cards ────────────────────────────── */
.table-card {
  background: #fff; border-radius: 12px; border: 1px solid #e8eaf0; overflow: hidden;
}
.table-card .card-header-bar {
  padding: .85rem 1.1rem; border-bottom: 1px solid #e8eaf0;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.table-card .card-header-bar h6 { margin: 0; font-weight: 600; }
.table th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
.table td { font-size: .85rem; }

/* ── Auth pages ─────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1f2e 0%, #1a7a4a 100%);
  padding: 1rem;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 2rem 1.5rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
@media (min-width: 480px) { .auth-card { padding: 2.5rem 2rem; } }
.auth-logo {
  font-size: 1.6rem; font-weight: 700; color: var(--brand-green);
  text-align: center; margin-bottom: 1.75rem; letter-spacing: .02em;
}
.auth-logo i { font-size: 2.2rem; display: block; margin-bottom: .3rem; }

/* ── Bottom nav (mobile rep) ────────────────── */
#bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 250;
  background: #fff; border-top: 1px solid #e8eaf0;
  padding: .4rem 0 env(safe-area-inset-bottom, .4rem);
}
@media (max-width: 767.98px) {
  body.role-rep #bottom-nav { display: flex; }
  body.role-rep .content-area { padding-bottom: 80px; }
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; padding: .4rem .2rem;
  text-decoration: none; color: #6c757d; font-size: .65rem; font-weight: 600;
  min-height: 52px;
}
.bottom-nav-item i { font-size: 1.3rem; }
.bottom-nav-item.active { color: var(--brand-green); }
.bottom-nav-item:hover  { color: var(--brand-green); }

/* ── Misc ───────────────────────────────────── */
.section-title { font-weight: 600; font-size: 1rem; margin-bottom: 1rem; color: #1a1f2e; }
.filters-bar { background: #fff; border: 1px solid #e8eaf0; border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; }
.badge { font-size: .72rem; font-weight: 600; }
.alert { border-radius: 10px; }
.form-control, .form-select { font-size: .875rem; }
.btn { font-size: .875rem; min-height: 38px; }
a { color: var(--brand-green); }
a:hover { color: #14603b; }

/* Touch-friendly form controls on mobile */
@media (max-width: 767.98px) {
  .form-control, .form-select { font-size: 16px !important; }
  .form-control-lg, .form-select-lg { min-height: 50px; }
  .btn { min-height: 44px; }
}