/* ============================================================
   HCMS Design System
   ============================================================ */
:root {
  --brand: #0d6e6e;
  --brand-dark: #094f4f;
  --brand-light: #14a3a3;
  --brand-50: #eafbfa;
  --brand-100: #d3f3f1;

  --ink: #0f172a;
  --ink-soft: #64748b;
  --ink-faint: #94a3b8;

  --border: #e6eaef;
  --surface: #ffffff;
  --bg: #f4f6f9;

  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(9, 79, 79, 0.22);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --sidebar-w: 250px;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  background: var(--bg);
  font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  font-size: 0.95rem;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; font-weight: 700; color: var(--ink); }

a { text-decoration: none; }

/* Tabular numbers for money / IDs / stats */
.stat-value, .table td.num, .money { font-variant-numeric: tabular-nums; }

::selection { background: var(--brand-100); color: var(--brand-dark); }

/* focus visibility kept accessible everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, .nav-link:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 2px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.app-navbar {
  background: linear-gradient(180deg, var(--brand-dark), #073e3e);
  padding: 0.65rem 1.25rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-navbar .navbar-brand {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-navbar .navbar-brand i { color: var(--brand-light); font-size: 1.05rem; }

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.sidebar-toggle-btn:hover { background: rgba(255, 255, 255, 0.18); }
.sidebar-toggle-btn:active { transform: scale(0.94); }

.app-navbar .badge.bg-light {
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.32em 0.6em;
}

.app-navbar .btn-outline-light {
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
  transition: all 0.15s ease;
}
.app-navbar .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: calc(100vh - 60px);
  position: relative;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.85rem 1.5rem;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.app-sidebar .nav { gap: 2px; display: flex; flex-direction: column; }

.app-sidebar .nav-link {
  color: var(--ink-soft);
  padding: 0.62rem 0.85rem;
  border-left: 3px solid transparent;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.app-sidebar .nav-link i {
  width: 18px;
  text-align: center;
  color: var(--brand);
  font-size: 0.92rem;
  flex-shrink: 0;
}
.app-sidebar .nav-link:hover {
  background: var(--brand-50);
  color: var(--brand-dark);
}
.app-sidebar .nav-link.active {
  background: var(--brand-50);
  border-left-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 700;
}
.app-sidebar .nav-link.active i { color: var(--brand-dark); }

.app-content {
  flex-grow: 1;
  padding: 1.9rem 2rem;
  max-width: 100%;
  min-width: 0;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.page-heading h4 { margin: 0; font-size: 1.35rem; }
.page-heading p { margin: 0.15rem 0 0; color: var(--ink-soft); font-size: 0.88rem; }

/* ============================================================
   CARDS / SURFACES
   ============================================================ */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-stat {
  border: none;
  border-radius: var(--radius);
  color: #fff;
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.card-stat::after {
  content: "";
  position: absolute;
  right: -24px; top: -24px;
  width: 110px; height: 110px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  z-index: -1;
}
.card-stat .stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
  font-weight: 600;
}
.card-stat .stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  margin-top: 0.15rem;
}
.card-stat.c1 { background: linear-gradient(135deg, #0d6e6e, #16b3ac); }
.card-stat.c2 { background: linear-gradient(135deg, #2c6fbb, #57a4ef); }
.card-stat.c3 { background: linear-gradient(135deg, #b5762b, #e6a94a); }
.card-stat.c4 { background: linear-gradient(135deg, #a63d5c, #d9698e); }

/* ============================================================
   FORMS
   ============================================================ */
.form-label { font-weight: 600; font-size: 0.85rem; color: var(--ink); margin-bottom: 0.35rem; }

.form-control, .form-select {
  border-radius: 9px;
  border: 1px solid var(--border);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.14);
}

.btn { border-radius: 9px; font-weight: 600; font-size: 0.9rem; }
.btn-primary, .btn.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
}
.btn-primary:hover, .btn.btn-brand:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--brand-dark);
}

.auth-shell {
  display: flex;
  width: 100%;
  max-width: 960px;
  margin: auto;
  min-height: 560px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.auth-brandpane {
  flex: 1 1 46%;
  background:
    radial-gradient(circle at 18% 15%, rgba(255,255,255,0.10), transparent 45%),
    linear-gradient(150deg, #0d6e6e 0%, #094f4f 70%);
  color: #fff;
  padding: 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-brandpane .brand-mark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.auth-brandpane .brand-mark i { color: var(--brand-light); font-size: 1.3rem; }

.auth-brandpane .brand-copy h2 {
  color: #fff;
  font-size: 1.6rem;
  line-height: 1.3;
  margin-bottom: 0.6rem;
}
.auth-brandpane .brand-copy p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  max-width: 320px;
}

/* Signature element: animated vitals trace */
.pulse-trace { width: 100%; height: 64px; margin-top: 1.5rem; opacity: 0.9; }
.pulse-trace path {
  fill: none;
  stroke: var(--brand-light);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: trace 3.2s ease-in-out infinite;
}
@keyframes trace {
  0% { stroke-dashoffset: 300; opacity: 0.3; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -300; opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse-trace path { animation: none; stroke-dashoffset: 0; }
}

.auth-formpane {
  flex: 1 1 54%;
  background: #fff;
  padding: 3rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-formpane h4 { font-size: 1.4rem; margin-bottom: 0.15rem; }
.auth-formpane .auth-sub { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 1.6rem; }

.auth-formpane .form-control {
  padding: 0.68rem 0.9rem;
}

.auth-formpane .btn {
  padding: 0.68rem;
  width: 100%;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.auth-formpane .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(13, 110, 110, 0.3);
}

/* legacy single-card auth fallback (kept for any other auth pages) */
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.4rem 2.2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
  background: #fff;
  border-radius: var(--radius);
  padding: 0.6rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.table { margin-bottom: 0; }
.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  padding: 0.85rem 0.9rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.8rem 0.9rem;
  vertical-align: middle;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.88rem;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--brand-50); }

.badge-role { text-transform: capitalize; border-radius: 6px; font-weight: 600; padding: 0.38em 0.65em; }

/* ============================================================
   RESPONSIVE / MOBILE SIDEBAR
   ============================================================ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1020;
  backdrop-filter: blur(1px);
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    z-index: 1025;
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  .app-wrapper.sidebar-open .app-sidebar { transform: translateX(0); }
  .app-wrapper.sidebar-open .sidebar-backdrop { display: block; }
  .app-content { padding: 1.25rem; }
  .card-stat { margin-bottom: 0.75rem; }

  .auth-shell { flex-direction: column; max-width: 420px; min-height: auto; }
  .auth-brandpane { padding: 1.75rem; }
  .auth-brandpane .brand-copy h2 { font-size: 1.25rem; }
  .auth-brandpane .brand-copy p { display: none; }
  .pulse-trace { height: 40px; margin-top: 0.75rem; }
  .auth-formpane { padding: 2rem 1.75rem; }
}

@media (max-width: 575.98px) {
  .app-content { padding: 1rem; }
  .page-heading h4 { font-size: 1.15rem; }
}

/* ============================================================
   HAMBURGER: mobile only / LOGO: always white
   ============================================================ */
.app-navbar .navbar-brand,
.app-navbar .navbar-brand i {
  color: #fff !important;
}
.auth-brandpane .brand-mark,
.auth-brandpane .brand-mark i {
  color: #fff !important;
}
.auth-brandpane .brand-mark i { color: var(--brand-light) !important; }

@media (min-width: 992px) {
  .sidebar-toggle-btn { display: none !important; }
}