/* public/styles/main.css */

:root {
  --primary: #0f172a;
  --primary-light: #334155;
  --accent: #2563eb;
  --danger: #dc2626;
  --success: #16a34a;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
}




/* --- Layout --- */
.container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 10px 24px 24px;
}

.row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.col {
  flex: 1;
  min-width: 280px;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;

  /* modern sticky look */
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);

  /* a bit more height */
  padding: 20px 32px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  box-shadow: 0 10px 18px -16px rgba(0, 0, 0, 0.35);
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

/* --- Header additions (logo + account label) --- */
.header-brand {
  display: flex;
  align-items: center;
}

.header-logo {
  height: 75px;
  width: auto;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-account-id {
  font-size: 13px;
  color: var(--text-muted);
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Navigation --- */
.nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.nav button {
  background: transparent;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 8px;
  transition: all 0.2s;
}

.nav button:hover {
  background: var(--bg-body);
  color: var(--text-main);
}

.nav button.active {
  background: var(--primary);
  color: #fff;
}


/* --- Page visibility --- */
.page,
.page-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active,
.page-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--primary);
}

/* --- Page 1: Overview cards transparent + centered --- */
/* --- Page 1: modern "glass" overview cards (still semi-transparent, not empty) --- */
.card-ghost {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 14px 28px -22px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);

  position: relative;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

/* subtle top accent line = modern touch */
.card-ghost::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(16, 185, 129, 0.9));
  opacity: 0.65;
}

.card-ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px -26px rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.82);
}

/* Make readonly Safe ID look "display-only" */
#pm-project-id[readonly] {
  background: #ffffff;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* --- Forms --- */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}

input,
select,
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  font-family: inherit;
  font-size: 14px;
}

input:focus,
select:focus,
.form-control:focus {
  border-color: var(--accent);
  outline: none;
  background: #fff;
}

/* --- Buttons --- */
button {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.1s, opacity 0.2s;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.success {
  background: var(--success);
  color: #fff;
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button.gray {
  background: #94a3b8;
  color: #fff;
}

button.secondary {
  background: #64748b;
  color: #fff;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Used in Page 4 upload button (you used btn-primary class) */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(0.98);
}

/* --- Tables --- */
.tableWrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tableWrap table {
  min-width: 800px;
}

thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 10;
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text-muted);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

tr:hover td {
  background: #f8fafc;
}

/* --- Utilities --- */
.muted {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.msg {
  font-size: 13px;
  margin-top: 10px;
  font-weight: 500;
}

.msg-danger {
  color: var(--danger);
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.big-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
}

.big-number-success {
  color: var(--success);
}

.center {
  text-align: center;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none !important;
}

/* Header row helper (used in results card) */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Tablewrap */
/* --- Page 1: Project Status Update (1.f) modern + stable layout --- */
.pm-projects-tableWrap {
  max-height: 320px;
  /* shows ~5 rows, then scroll */
  overflow-y: auto;
  overflow-x: hidden;

  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 28px -24px rgba(0, 0, 0, 0.45);
}

.pm-projects-tableWrap table {
  width: 100%;
  min-width: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  /* stops column width jumping */
  font-size: 13px;
}

/* Sticky header for modern feel */
.pm-projects-tableWrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(248, 250, 252, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.pm-projects-tableWrap th,
.pm-projects-tableWrap td {
  padding: 12px 14px;
  vertical-align: middle;
}

/* Nice hover */
.pm-projects-tableWrap tbody tr:hover {
  background: rgba(2, 6, 23, 0.03);
}

/* Locked column widths (5 columns) */
.pm-projects-tableWrap th:nth-child(1),
.pm-projects-tableWrap td:nth-child(1) {
  width: 24%;
}

/* Project Name */

.pm-projects-tableWrap th:nth-child(2),
.pm-projects-tableWrap td:nth-child(2) {
  width: 36%;
}

/* Project ID */

.pm-projects-tableWrap th:nth-child(3),
.pm-projects-tableWrap td:nth-child(3) {
  width: 22%;
}

/* Project Code */

.pm-projects-tableWrap th:nth-child(4),
.pm-projects-tableWrap td:nth-child(4) {
  width: 9%;
  text-align: center;
}

/* Status */

.pm-projects-tableWrap th:nth-child(5),
.pm-projects-tableWrap td:nth-child(5) {
  width: 9%;
  text-align: center;
}

/* Update */

/* Prevent width changes from button text */
.pm-projects-tableWrap .btn-classy.toggle-status {
  min-width: 110px;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: nowrap;
}

.pm-projects-tableWrap .btn.btnSmall {
  min-width: 78px;
  padding: 8px 12px;
  border-radius: 10px;
}

/* Premium row feel */
.pm-projects-tableWrap tbody tr:hover td {
  background: rgba(2, 6, 23, 0.03);
}

.pm-projects-tableWrap tbody tr:nth-child(even) td {
  background: rgba(248, 250, 252, 0.65);
}

/* Keep long IDs clean */
.pm-projects-tableWrap td:nth-child(1),
.pm-projects-tableWrap td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-projects-tableWrap td:nth-child(3) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-projects-tableWrap td:nth-child(3) span[title="Project Code"] {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Page 1: Assign User + Create User (make controls symmetrical) --- */
#pm-assign-project,
#pm-assign-user,
#pm-new-user-email,
#pm-new-user-pass {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}

#pm-assign-project:focus,
#pm-assign-user:focus,
#pm-new-user-email:focus,
#pm-new-user-pass:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

/* Make selects feel modern */
#pm-assign-project,
#pm-assign-user {
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.55) 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.55) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* ============================
   Page 1 - Users List (premium)
   ============================ */
.pm-users-tableWrap {
  /* vertical scroll like Project Status Update */
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;

  /* keep the same card/table premium feel */
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

/* override generic .tableWrap table { min-width: 800px; } for Users List */
.pm-users-tableWrap table {
  min-width: 0 !important;
  width: 100%;
  table-layout: fixed;
  /* IMPORTANT: stops column width jumping */
}

.pm-users-tableWrap th,
.pm-users-tableWrap td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-users-tableWrap thead th:nth-child(1) {
  width: 48%;
}

.pm-users-tableWrap thead th:nth-child(2) {
  width: 32%;
}

.pm-users-tableWrap thead th:nth-child(3) {
  width: 10%;
  text-align: center;
}

.pm-users-tableWrap thead th:nth-child(4) {
  width: 10%;
  text-align: right;
}

.pm-users-tableWrap td:nth-child(2) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.pm-users-tableWrap td:nth-child(3) {
  text-align: center;
}

.pm-users-tableWrap td:nth-child(4) {
  text-align: right;
}

/* stop "Enable/Disable" button changing column width */
.pm-users-tableWrap .toggle-user {
  min-width: 92px;
}

/* --- Assigned Users list: show ~5 items then scroll --- */
.assigned-users-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;

  max-height: 270px;
  /* ~5 rows visible */
  overflow-y: auto;
  scrollbar-gutter: stable;

  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.75);
}

.assigned-users-list li {
  padding: 0;
  margin: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.assigned-users-list li:last-child {
  border-bottom: none;
}

.assigned-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.assigned-user-row span {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Override the inline button style from UI renderer */
.assigned-user-row button {
  border: 1px solid rgba(239, 68, 68, 0.22) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #ef4444 !important;
  border-radius: 12px !important;
  padding: 7px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer;
  white-space: nowrap;
}

.assigned-user-row button:hover {
  background: rgba(239, 68, 68, 0.08) !important;
}

/* Password toggle */
.password-wrapper {
  position: relative;
}

.password-toggle-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;

  color: #334155;
  /* IMPORTANT: makes currentColor visible */
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
}

.password-toggle-icon:hover {
  background: rgba(2, 6, 23, 0.06);
}

.password-toggle-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}


/* Small spacing helpers (keep if you use them) */
.mb-10 {
  margin-bottom: 10px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-15 {
  margin-bottom: 15px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 14px;
}

/* Card left accents (if you used these classes in HTML) */
.border-left-primary {
  border-left: 5px solid var(--primary);
}

.border-left-accent {
  border-left: 5px solid var(--accent);
}

/* Soft box used in create user card */
.soft-box {
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
}

.pr-40 {
  padding-right: 40px;
}

.flex-2 {
  flex: 2;
}

.minw-220 {
  min-width: 220px;
}

.align-end {
  align-items: flex-end;
}

.ps-settings-left {
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.ps-bulk-box {
  border: 1px solid rgba(15, 23, 42, 0.10);
}

.ps-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}


/* Style for the Sample Download Button */
#vd-download-template-btn {
  margin-left: 10px;
  background-color: #6c757d;
  /* Optional: Grey color to differentiate from Upload */
  color: white;
}

#vd-download-template-btn:hover {
  background-color: #5a6268;
}

/* For showing error in page 4 */
/* Master CSV validation report */
.msg.report {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.msg.report.error {
  border-color: var(--danger);
}

.msg.report.ok {
  border-color: var(--success);
}

.msg .report-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.msg .report-sub {
  font-size: 12px;
  opacity: .8;
  margin-bottom: 8px;
}

.msg .report-list {
  max-height: 220px;
  overflow: auto;
  padding-left: 18px;
  margin: 0;
}

.msg .report-list li {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.35;
}

.msg .report-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  background: #f1f5f9;
}


/* ============================
   Page 2 - Top dual card section
   ============================ */
.ps-top-card {
  min-width: 320px;
}

#ps-project-select,
#ps-current-project,
#ps-master-file {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}

#ps-project-select:focus,
#ps-current-project:focus,
#ps-master-file:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

#ps-project-select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.55) 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.55) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

#ps-current-project[readonly] {
  background: #ffffff;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#ps-master-file::file-selector-button {
  border: none;
  background: #e2e8f0;
  color: var(--primary);
  padding: 8px 12px;
  border-radius: 10px;
  margin-right: 12px;
  cursor: pointer;
  font-weight: 600;
}

#bulk-actions-container {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#ps-msg,
#ps-master-msg {
  min-height: 20px;
}


/* =========================
   Page 2 top 50/50 layout
   ========================= */
.row-gap-12 {
  row-gap: 12px;
}

.ps-top-grid {
  align-items: stretch;
}

.ps-top-grid>.col {
  min-width: 340px;
  display: flex;
}

.ps-top-panel {
  width: 100%;
  min-height: 100%;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.88);
  box-shadow: 0 14px 28px -24px rgba(0, 0, 0, 0.25);
  padding: 18px;
}

#ps-bulk-slot {
  width: 100%;
}

#ps-bulk-slot>.ps-top-panel {
  height: 100%;
}

#ps-project-select,
#ps-current-project,
#ps-master-file {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}

#ps-load-btn,
#btn-master-upload,
#btn-master-template {
  min-height: 44px;
  border-radius: 12px;
}

#ps-current-project[disabled] {
  background: #ffffff;
  color: var(--text-muted);
}

#ps-master-file::file-selector-button {
  border: none;
  background: #e2e8f0;
  color: var(--primary);
  padding: 8px 12px;
  border-radius: 10px;
  margin-right: 12px;
  cursor: pointer;
  font-weight: 600;
}

/* =========================
   Page 2 - Data Hierarchy
   ========================= */
.dh-card {
  margin-bottom: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px -28px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.dh-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}

.dh-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.dh-panel {
  display: none;
  padding: 0 20px 20px 20px;
}

.dh-split {
  display: grid;
  grid-template-columns: minmax(280px, 25%) minmax(0, 75%);
  gap: 18px;
  align-items: start;
}

.dh-left-box,
.dh-right-box {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: #f8fafc;
  padding: 16px;
}

.dh-left-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.dh-left-box input,
.dh-left-box select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  padding: 10px 12px;
  box-sizing: border-box;
}

.dh-left-box input:focus,
.dh-left-box select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.dh-action-stack {
  display: grid;
  gap: 10px;
}

.dh-context-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 14px;
}

.dh-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 8px;
}

.dh-mini-note {
  font-size: 12px;
  color: var(--text-muted);
}

.dh-table-wrap {
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 14px;
  background: #fff;
}

.dh-table-wrap table {
  min-width: 0 !important;
  width: 100%;
  table-layout: fixed;
}

.dh-table-wrap th,
.dh-table-wrap td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dh-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(241, 245, 249, 0.95);
  backdrop-filter: blur(8px);
}

.dh-recent-wrap {
  max-height: 240px;
}

.dh-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.dh-pager {
  display: flex;
  gap: 8px;
}

.dh-empty {
  text-align: center;
  padding: 18px 14px;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .dh-split {
    grid-template-columns: 1fr;
  }
}


/* ===== Data Hierarchy alignment fixes ===== */

.dh-context-chip {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr) 180px;
  align-items: center;
  gap: 12px;
}

.dh-ctx-label {
  font-weight: 800;
  color: #1e3a8a;
  text-align: left;
}

.dh-ctx-value {
  font-weight: 800;
  color: #2563eb;
  text-align: center;
}

.dh-ctx-id {
  font-weight: 700;
  color: #1e3a8a;
  text-align: right;
}

.dh-table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.dh-th-name,
.dh-col-name {
  width: 34%;
  text-align: left;
}

.dh-th-context,
.dh-col-context {
  width: 38%;
  text-align: left;
}

.dh-th-dept,
.dh-col-dept {
  width: 16%;
  text-align: left;
}

.dh-th-class,
.dh-col-class {
  width: 12%;
  text-align: left;
}

.dh-th-action,
.dh-col-action {
  width: 140px;
  text-align: right;
}

.dh-col-context,
.dh-col-dept,
.dh-col-class {
  font-size: 12px;
}

.dh-col-action {
  vertical-align: middle;
}

.dh-delete-btn {
  min-width: 92px;
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1100px) {
  .dh-context-chip {
    grid-template-columns: 1fr;
  }

  .dh-ctx-label,
  .dh-ctx-value,
  .dh-ctx-id {
    text-align: left;
  }
}


/* =========================
Page 3 top 30 / 20 / 20 / 30 layout
========================= */
.cd-top-grid {
  align-items: stretch;
  margin-bottom: 18px;
}

.cd-top-grid>.col {
  display: flex;
}

.cd-top-col-control {
  flex: 0 0 30%;
  max-width: 30%;
}

.cd-top-col-metric {
  flex: 0 0 20%;
  max-width: 20%;
}

.cd-top-col-userwise {
  flex: 0 0 25%;
  max-width: 25%;
}

.cd-top-card {
  width: 100%;
  min-height: 100%;
  margin-bottom: 0;
}

.cd-control-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#cd-project-select,
#cd-current-project {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
}

#cd-project-select:focus,
#cd-current-project:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

#cd-project-select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.55) 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.55) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

#cd-current-project[disabled] {
  background: #ffffff;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.cd-metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cd-userwise-card {
  display: flex;
  flex-direction: column;
}

.cd-userwise-table-wrap {
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  max-height: 252px;
  /* around 5 rows visible */
  overflow-y: auto;
}

.cd-userwise-table {
  width: 100%;
  min-width: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
}

.cd-userwise-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f97316;
  color: #ffffff;
  padding: 10px 12px;
  font-weight: 700;
}

.cd-userwise-table thead th:last-child {
  text-align: right;
}

.cd-userwise-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: middle;
}

.cd-userwise-table td:last-child {
  text-align: right;
}

.cd-userwise-table tbody tr:last-child td {
  border-bottom: none;
}

#cd-userwise-msg {
  min-height: 18px;
  margin-top: 8px;
}

@media (max-width: 1100px) {

  .cd-top-col-control,
  .cd-top-col-metric,
  .cd-top-col-userwise {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* =========================
Page 3 search + export row
========================= */
.cd-action-grid {
  display: grid;
  grid-template-columns: minmax(0, calc(70% - 6px)) minmax(0, calc(30% - 6px));
  column-gap: 12px;
  /* same style gap as top section */
  align-items: stretch;
  width: 100%;
  margin-bottom: 16px;
}

.cd-action-grid>.col {
  display: flex;
  min-width: 0;
}

.cd-action-left,
.cd-action-right {
  min-width: 0;
  max-width: none;
}

.cd-action-card {
  width: 100%;
  margin-bottom: 0;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.06),
    0 2px 10px rgba(15, 23, 42, 0.04);
}

.cd-filter-card,
.cd-export-card {
  position: relative;
  overflow: hidden;
}

.cd-filter-card::before,
.cd-export-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #60a5fa 0%, #22c55e 100%);
}

.cd-filter-card h3,
.cd-export-card h3 {
  margin-bottom: 14px;
}

.cd-export-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.cd-btn-light {
  min-height: 46px;
  border: none;
  border-radius: 12px;
  background: #60a5fa;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(96, 165, 250, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.cd-btn-light:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(96, 165, 250, 0.34);
}

.cd-btn-orange {
  min-height: 46px;
  border: none;
  border-radius: 12px;
  background: #f97316;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.cd-btn-orange:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(249, 115, 22, 0.34);
}

.cd-filter-card input,
.cd-filter-card select {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 12px;
}

#cd-filter-msg,
#cd-export-msg,
#vd-filter-msg,
#vd-export-msg {
  min-height: 18px;
  margin-top: 10px;
}

@media (max-width: 1100px) {

  .cd-action-left,
  .cd-action-right {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

.cd-filter-card .row.row-gap-12.mt-14 {
  margin-top: 18px;
  padding-top: 6px;
}

.cd-export-card .mt-16 {
  margin-top: 22px;
}

.cd-export-card .mt-12 {
  margin-top: 14px;
}

/*================================
Page 3 Duplicate or Update Showing Section
=================================*/
/* =========================
Page 3 duplicate / update review card
========================= */
.cd-review-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06), 0 2px 10px rgba(15, 23, 42, 0.04);
  margin-bottom: 16px;
}

.cd-review-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #60a5fa 0%, #22c55e 100%);
}

.cd-review-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.cd-review-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cd-review-tab {
  min-width: 120px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(249, 115, 22, 0.16);
  color: #c2410c;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid rgba(249, 115, 22, 0.18);
}

#cd-audit-tab-duplicate:checked~.cd-review-top label[for="cd-audit-tab-duplicate"],
#cd-audit-tab-update:checked~.cd-review-top label[for="cd-audit-tab-update"] {
  background: #f97316;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.28);
}

.cd-review-export-btn {
  width: 160px;
  min-width: 160px;
}

.cd-review-panel {
  display: block;
}

#cd-audit-tab-duplicate:checked~.cd-review-panels .cd-update-panel {
  display: none;
}

#cd-audit-tab-update:checked~.cd-review-panels .cd-duplicate-panel {
  display: none;
}

.cd-mini-table-wrap {
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  overflow: auto;
  max-height: 560px;
}

.cd-mini-table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
}

.cd-mini-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #3b82f6;
  color: #ffffff;
  padding: 10px 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cd-mini-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: middle;
  color: #1e293b;
  word-break: break-word;
}

.cd-mini-table tbody tr:last-child td {
  border-bottom: none;
}

.cd-empty-row td {
  text-align: center;
  color: #64748b;
  padding: 18px 12px;
}

.cd-mini-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 12px;
}

.cd-mini-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cd-mini-pagination button {
  min-width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}

.cd-mini-pagination button.active {
  background: #3b82f6;
  color: #ffffff;
}

@media (max-width: 1100px) {
  .cd-review-top {
    flex-direction: column;
    align-items: stretch;
  }

  .cd-review-export-btn {
    width: 100%;
    min-width: 0;
  }
}

#vd-audit-tab-duplicate:checked~.cd-review-top label[for="vd-audit-tab-duplicate"],
#vd-audit-tab-update:checked~.cd-review-top label[for="vd-audit-tab-update"],
#vd-audit-tab-verified:checked~.cd-review-top label[for="vd-audit-tab-verified"] {
  background: #f97316;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.28);
}

#vd-audit-tab-duplicate:checked~.cd-review-panels .vd-update-panel,
#vd-audit-tab-duplicate:checked~.cd-review-panels .vd-missing-panel,
#vd-audit-tab-duplicate:checked~.cd-review-panels .vd-verified-panel,

#vd-audit-tab-update:checked~.cd-review-panels .vd-duplicate-panel,
#vd-audit-tab-update:checked~.cd-review-panels .vd-missing-panel,
#vd-audit-tab-update:checked~.cd-review-panels .vd-verified-panel,

#vd-audit-tab-verified:checked~.cd-review-panels .vd-duplicate-panel,
#vd-audit-tab-verified:checked~.cd-review-panels .vd-update-panel,
#vd-audit-tab-verified:checked~.cd-review-panels .vd-missing-panel {
  display: none;
}

.ps-summary-card {
  text-align: left !important;
  padding: 22px 20px;
}

.ps-summary-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.ps-summary-head h3 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
}

.ps-summary-note {
  font-size: 12px;
  color: #64748b;
}

.ps-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ps-summary-row {
  width: 100%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ps-summary-row:hover:not(:disabled) {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.ps-summary-row:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ps-summary-label {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.ps-summary-value {
  min-width: 36px;
  text-align: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}


/* =========================
   Login Screen
========================= */
/* ===== Login Screen - Portrait Compact ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10px;
  padding-left: 0;
  padding-right: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, #eef3f9 0%, #f8fafc 100%);
}

.login-card {
  width: min(26vw, 430px);
  min-width: 380px;
  max-width: 430px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
  padding: 22px 28px 20px;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.login-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
}

.login-head {
  text-align: center;
  margin-bottom: 18px;
}

.login-head h2 {
  margin: 0 0 6px;
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--primary);
}

.login-head p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text-main);
}

.login-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-field input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}

#login-error {
  min-height: 20px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .login-card {
    width: min(88vw, 430px);
    min-width: unset;
  }
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap input {
  padding-right: 78px;
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}

.login-password-toggle:hover {
  opacity: 0.85;
}

.login-password-toggle:focus {
  outline: none;
}

@media (max-width: 1100px) {
  .login-card {
    width: min(42vw, 430px);
  }
}

@media (max-width: 900px) {
  .login-card {
    width: min(88vw, 430px);
    min-width: unset;
  }
}