/* Nest UI — matches Siliris ERP desk theme (Frappe-like) */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --topbar-height: 56px;
  --primary: #1a56db;
  --primary-dark: #1440a8;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #1a56db;
  --sidebar-hover: #1e293b;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  margin: 0;
}

body.app-shell { display: flex; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid #1e293b;
  min-height: var(--topbar-height);
  text-decoration: none;
}
.brand-logo {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; flex-shrink: 0;
}
.brand-logo-img {
  width: 72px; height: 28px;
  max-width: 72px; max-height: 28px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-logo-img img {
  width: 72px !important;
  height: 20px !important;
  max-width: 72px !important;
  max-height: 20px !important;
  object-fit: contain;
  display: block;
}
.brand-name { color: #f1f5f9; font-weight: 700; font-size: 15px; display: block; text-transform: uppercase; letter-spacing: .04em; }
.brand-sub  { color: var(--sidebar-text); font-size: 11px; display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}
.nav-section-label {
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 12px 12px 6px;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.sidebar .nav-item i { font-size: 16px; width: 20px; text-align: center; }
.sidebar .nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar .nav-item.active { background: var(--sidebar-active); color: #fff; }

.sidebar-footer {
  border-top: 1px solid #1e293b;
  padding: 12px;
  color: var(--sidebar-text);
  font-size: 12px;
}

/* ── Main ────────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin: 0; }
.nest-main { padding: 20px; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; }
.nest-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 12px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h4 { margin: 0; font-weight: 700; font-size: 1.15rem; }

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  background: var(--card-bg);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.badge-stage {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}

.nest-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 1.4rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  transition: box-shadow .15s ease, border-color .15s ease;
  height: 100%;
}
.nest-tile:hover {
  border-color: #bfdbfe;
  box-shadow: 0 4px 16px rgba(26,86,219,.08);
  color: inherit;
}
.nest-tile h3 { font-size: 1.1rem; margin-bottom: .35rem; color: var(--text); font-weight: 700; }

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }
.stat-card .stat-value { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.stat-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eff6ff; color: var(--primary); font-size: 16px;
}

.profile-rail {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}
.profile-photo {
  width: 120px; height: 120px; border-radius: 12px;
  object-fit: cover; background: #f1f5f9; margin-bottom: .75rem;
}

.table > :not(caption) > * > * { background: transparent; }
.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom-width: 1px;
}

/* ── Login / 2FA (matches ERP screenshots) ───────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0f172a;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo {
  width: 48px; height: 48px;
  background: #1a56db;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: #fff; font-size: 24px;
}
.login-logo-img {
  width: auto; height: 36px;
  background: transparent;
  border-radius: 0;
  margin: 0 auto 14px;
}
.login-logo-img img {
  height: 36px !important; width: auto !important; max-width: 160px !important;
  object-fit: contain; display: block;
}
.login-title {
  font-size: 22px; font-weight: 700; text-align: center;
  color: #0f172a; margin-bottom: 4px;
}
.login-sub {
  text-align: center; color: #64748b; font-size: 13px; margin-bottom: 28px;
}
.login-card .form-label { font-weight: 500; font-size: 13px; }
.login-card .form-control {
  font-size: 13px; padding: 10px 12px; border-radius: 7px;
}
.btn-login {
  width: 100%; padding: 10px; font-size: 15px; font-weight: 600;
  border-radius: 7px; background: #1a56db; border: none; color: #fff;
}
.btn-login:hover { background: #1440a8; color: #fff; }
.totp-input {
  font-size: 28px; font-weight: 700; letter-spacing: 10px;
  text-align: center; padding: 12px; border-radius: 7px;
}
.step-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eff6ff; color: #1a56db; border-radius: 20px;
  padding: 4px 12px; font-size: 12px; font-weight: 600; margin-bottom: 16px;
}

.help-list .list-group-item { border-color: var(--border); }
.help-list .list-group-item:hover { background: #f8fafc; }

@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .brand-text,
  .sidebar .nav-item span,
  .sidebar .nav-section-label,
  .sidebar-footer .sf-text { display: none; }
  .main-wrap { margin-left: var(--sidebar-collapsed); }
  .sidebar .nav-item { justify-content: center; padding: 10px; }
}
