:root {
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --bg-app: #f1f5f9;
  --bg-sidebar: #0f172a;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sidebar: #94a3b8;
  --border-light: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --font-sans: 'Inter', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  color: #fff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.sidebar-logo {
  padding: 24px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-menu {
  flex: 1;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  padding: 0 24px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sidebar);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.nav-project-select {
  margin: 0 24px 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  outline: none;
}

.nav-project-select option {
  color: #000;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 8px 0 16px;
}

.nav-item {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-sidebar);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-item:hover {
  color: #fff;
}

.nav-item.active {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--primary);
  border-right: 3px solid var(--primary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

/* Smart Search button — native to dark sidebar */
#nav-smart-search-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
}
#nav-smart-search-btn:hover kbd {
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.18);
}

.badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}

/* Main Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.breadcrumbs {
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.breadcrumbs span {
  color: var(--text-main);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Page Views */
.page-view {
  display: none;
  height: 100%;
  flex-direction: column;
}
.page-view.active {
  display: flex;
}

/* Content */
.content-area {
  padding: 32px;
  overflow-y: auto;
  flex: 1;
}

.file-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-light);
}

.file-table th,
.file-table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.file-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.file-table tr {
  transition: background 0.15s;
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-table tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

.file-table td svg {
  width: 24px;
  height: 24px;
}

.status-badge {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
}

.status-wip {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-shared {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Modal Wizard */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #fff;
  width: 850px;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
  overflow: hidden;
}

.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  padding: 4px;
  transition: background 0.2s;
}

.btn-close:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  padding: 32px;
  overflow-y: auto;
  max-height: 70vh;
  flex: 1;
}

.drop-zone {
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  background: #f0f9ff;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.drop-zone:hover,
.drop-zone.dragover {
  background: #e0f2fe;
  border-color: var(--primary-hover);
  transform: scale(1.02);
}

.drop-zone h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.drop-zone p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-select {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-weight: 500;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.preview-table th,
.preview-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

.preview-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.iso-name {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-weight: 600;
  color: var(--success);
  background: #ecfdf5;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
}

.modal-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  background: #f8fafc;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Box Module (Dalux Style) */
.box-layout {
  display: flex;
  height: calc(100vh - 100px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  overflow: hidden;
  margin: 20px;
}

.box-sidebar {
  width: 260px;
  background: #f8fafc;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.box-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.box-tree {
  padding: 12px 0;
  overflow-y: auto;
}

.tree-node {
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.2s;
}

.tree-node i {
  width: 18px;
  height: 18px;
}

.tree-node:hover {
  background: #f1f5f9;
}

.tree-node.active {
  background: #e0f2fe;
  color: var(--primary);
  font-weight: 600;
}

.box-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.box-content-area {
  flex: 1;
  overflow-y: auto;
}

.box-meta-panel {
  width: 0;
  background: #fff;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
}

.box-meta-panel.open {
  width: 380px;
}

.meta-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  background: #f8fafc;
  min-width: 380px;
}

.meta-content {
  min-width: 380px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.table-hoverable tbody tr.selected {
  background: #e0f2fe;
}

/* Batch Upload Modal Styles */
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin-icon {
  animation: spinSlow 2s linear infinite;
}

.batch-table th, .batch-table td {
  padding: 8px 10px;
  vertical-align: middle;
}
.batch-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s;
}
.batch-table td select, .batch-table td input {
  width: 100%;
  padding: 6px 4px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  background: #fff;
  color: var(--text-main);
}
.batch-table td select:disabled, .batch-table td input:disabled {
  opacity: 0.6;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.batch-table td select:focus, .batch-table td input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14,165,233,0.1);
}
.ai-processing-row td {
  background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #f1f5f9 10px, #f1f5f9 20px);
  color: var(--text-muted);
}
.ai-success-col {
  color: var(--success);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
}

/* ===== ISO SETTINGS BUILDER ===== */
.iso-builder-track {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
}

.iso-field-block {
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 120px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iso-field-block:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.iso-field-block.active {
  border-color: var(--primary);
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
}

.iso-field-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  text-transform: uppercase;
}

.iso-field-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 99px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}
.iso-field-badge.req {
  background: #dcfce7;
  color: #166534;
}
.iso-field-badge.opt {
  background: #f1f5f9;
  color: #64748b;
}

.iso-field-dash {
  font-weight: 800;
  font-size: 1.5rem;
  color: #cbd5e1;
  margin: 0 12px;
}

.dictionary-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}
.dictionary-table tr:hover {
  background: #f8fafc;
}

/* =========================================
   DASHBOARD BENTO BOX STYLES
   ========================================= */
.bento-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}
.bento-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  border-color: #cbd5e1;
}

.bento-header {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 16px;
}

/* KPI Cards */
.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-title {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  max-width: 70%;
  line-height: 1.4;
  margin: 0;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.kpi-value.warning { color: #b45309; }
.kpi-value.danger { color: #b91c1c; }

.kpi-trend {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-trend.trend-up { color: #10b981; }
.kpi-trend.trend-down { color: #b91c1c; }

/* =========================================
   GLOBAL HUB NAVIGATION & TABLES
   ========================================= */
.hub-nav-item {
   background: transparent;
   border: none;
   color: #94a3b8;
   padding: 0 16px;
   font-size: 0.9rem;
   font-weight: 600;
   height: 100%;
   display: flex;
   align-items: center;
   cursor: pointer;
   position: relative;
   transition: color 0.2s;
}

.hub-nav-item:hover {
   color: #fff;
}

.hub-nav-item.active {
   color: #fff;
}

.hub-nav-item.active::after {
   content: '';
   position: absolute;
   bottom: 0;
   left: 0;
   right: 0;
   height: 3px;
   background: var(--primary);
   border-radius: 3px 3px 0 0;
}

.hub-table tbody tr:hover {
   background: #f8fafc;
}

/* =========================================
   LOGIN SCREEN
   ========================================= */
.login-container {
   display: flex;
   min-height: 100vh;
   background: #fff;
}

.login-left {
   flex: 1;
   background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
   color: #fff;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   padding: 40px;
   position: relative;
   overflow: hidden;
}

.login-left::before {
   content: '';
   position: absolute;
   top: -50%;
   left: -50%;
   width: 200%;
   height: 200%;
   background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, transparent 60%);
   transform: rotate(30deg);
}

.login-brand {
   position: relative;
   z-index: 10;
   text-align: center;
}

.login-brand h1 {
   font-size: 2.8rem;
   font-weight: 800;
   margin-bottom: 16px;
   letter-spacing: -0.02em;
}

.login-brand p {
   font-size: 1.1rem;
   color: #94a3b8;
   max-width: 420px;
   line-height: 1.6;
}

.login-right {
   flex: 1;
   display: flex;
   justify-content: center;
   align-items: center;
   padding: 40px;
   background: #f8fafc;
}

.login-card {
   width: 100%;
   max-width: 440px;
   background: #fff;
   padding: 48px;
   border-radius: 20px;
   box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.01);
   border: 1px solid #e2e8f0;
}

.login-card h2 {
   font-size: 1.8rem;
   font-weight: 800;
   color: #0f172a;
   margin-bottom: 8px;
}

.login-card p {
   color: #64748b;
   margin-bottom: 32px;
   font-size: 0.95rem;
}

.login-input {
   width: 100%;
   padding: 12px 16px;
   border: 1px solid #cbd5e1;
   border-radius: 10px;
   font-family: var(--font-sans);
   font-size: 0.95rem;
   outline: none;
   transition: all 0.2s;
   background: #f8fafc;
   color: #0f172a;
}

.login-input:focus {
   border-color: var(--primary);
   box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
   background: #fff;
}

.login-btn-submit {
   width: 100%;
   background: var(--primary);
   color: #fff;
   border: none;
   padding: 14px;
   border-radius: 10px;
   font-size: 1rem;
   font-weight: 700;
   cursor: pointer;
   transition: background 0.2s, transform 0.1s;
   margin-top: 16px;
   box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.2);
}

.login-btn-submit:hover {
   background: var(--primary-hover);
   transform: translateY(-1px);
}

.login-btn-submit:active {
   transform: translateY(0);
}

.demo-credentials {
   margin-top: 32px;
   padding: 16px;
   background: #f1f5f9;
   border-radius: 10px;
   font-size: 0.85rem;
   color: #475569;
   border: 1px dashed #cbd5e1;
}

.demo-credentials strong {
   color: #0f172a;
   display: block;
   margin-bottom: 8px;
}

.demo-credentials code {
   font-family: 'SFMono-Regular', Consolas, monospace;
   background: #e2e8f0;
   padding: 2px 6px;
   border-radius: 4px;
   color: #0ea5e9;
   font-weight: 600;
}

.login-footer {
   text-align: center;
   margin-top: 24px;
}

.login-footer a {
   color: var(--primary);
   text-decoration: none;
   font-weight: 600;
   font-size: 0.9rem;
}

.login-footer a:hover {
   text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
   .login-container {
      flex-direction: column;
   }
   .login-left {
      flex: none;
      padding: 60px 20px;
   }
   .login-right {
      padding: 24px;
   }
   .login-card {
      padding: 32px 24px;
   }
}

/* ==========================================
   WORKFLOW ACTION BUTTONS (Table Contextual)
   ========================================== */
.btn-action {
   display: inline-flex;
   align-items: center;
   gap: 5px;
   padding: 5px 10px;
   border-radius: 6px;
   font-size: 0.75rem;
   font-weight: 700;
   border: 1px solid transparent;
   cursor: pointer;
   white-space: nowrap;
   transition: all 0.15s ease;
   background: #f1f5f9;
   color: #0f172a;
}
.btn-action i { width: 13px; height: 13px; }
.btn-action:hover { filter: brightness(0.92); transform: translateY(-1px); }

.btn-action.primary  { background: var(--primary); color: #fff; border-color: var(--primary-hover); }
.btn-action.success  { background: #10b981; color: #fff; border-color: #059669; }
.btn-action.warning  { background: #f59e0b; color: #fff; border-color: #d97706; }
.btn-action.danger   { background: #ef4444; color: #fff; border-color: #dc2626; }

/* Pending Approval row highlight */
.status-pill.pending-approval {
   background: #fef3c7;
   color: #92400e;
   border: 1px solid #fde68a;
}

/* RETURNED FOR CORRECTION — distinct red/orange pill */
.status-pill.status-returned-for-correction {
   background: #fef2f2;
   color: #991b1b;
   border: 1px solid #fca5a5;
   font-weight: 700;
}
.status-pill.status-returned-for-correction .status-dot {
   background: #dc2626;
   box-shadow: 0 0 0 3px rgba(220,38,38,0.2);
   animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
   0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
   50% { box-shadow: 0 0 0 4px rgba(220,38,38,0); }
}

/* ==========================================
   ADD CONTAINER MODAL — ISO 19650 Form
   ========================================== */
.iso-naming-grid {
   display: grid;
   grid-template-columns: repeat(7, 1fr);
   gap: 6px;
   margin-bottom: 4px;
}
.iso-naming-grid .iso-field label {
   display: block;
   font-size: 0.65rem;
   font-weight: 700;
   text-transform: uppercase;
   color: var(--text-muted);
   margin-bottom: 3px;
   letter-spacing: 0.04em;
}
.iso-naming-grid .iso-field input,
.iso-naming-grid .iso-field select {
   width: 100%;
   padding: 6px 8px;
   font-size: 0.8rem;
   font-weight: 700;
   font-family: monospace;
   border: 1.5px solid #e2e8f0;
   border-radius: 6px;
   text-transform: uppercase;
   text-align: center;
   background: #f8fafc;
   color: #0f172a;
   transition: border-color 0.2s;
}
.iso-naming-grid .iso-field input:focus,
.iso-naming-grid .iso-field select:focus {
   outline: none;
   border-color: var(--primary);
   background: #fff;
}
.iso-name-preview {
   font-family: monospace;
   font-size: 0.9rem;
   font-weight: 700;
   color: var(--primary);
   background: #f0f9ff;
   border: 1.5px dashed #bae6fd;
   border-radius: 8px;
   padding: 10px 16px;
   text-align: center;
   letter-spacing: 0.05em;
   min-height: 40px;
   display: flex;
   align-items: center;
   justify-content: center;
}
/* Role info message in meta panel */
.role-info-msg {
   display: flex;
   align-items: center;
   gap: 8px;
   background: #f8fafc;
   border: 1px dashed #cbd5e1;
   border-radius: 8px;
   padding: 10px 14px;
   font-size: 0.8rem;
   color: #64748b;
   line-height: 1.4;
}
.role-info-msg i { flex-shrink: 0; color: #94a3b8; }
.role-info-msg strong { color: #0f172a; }

/* ==========================================
   GLOBAL META PANEL (fixed overlay, all CDE zones)
   ========================================== */
#metaPanel {
   display: none;
   flex-direction: column;
}
#metaPanel.open {
   display: flex !important;
}
/* Zone badge coloring inside meta panel */
#metaPanelZoneBadge[data-zone="wip"]       { color: #0284c7; }
#metaPanelZoneBadge[data-zone="shared"]    { color: #166534; }
#metaPanelZoneBadge[data-zone="published"] { color: #166534; background:#dcfce7; padding:2px 8px; border-radius:4px; }
#metaPanelZoneBadge[data-zone="archived"]  { color: #64748b; }

/* ==========================================
   SITE INSTRUCTIONS MODULE
   ========================================== */

/* Status Pills */
.si-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.si-pill-draft     { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.si-pill-inreview  { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.si-pill-published { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

.si-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.si-pill-draft .si-pill-dot     { background: #d97706; }
.si-pill-inreview .si-pill-dot  { background: #7c3aed; }
.si-pill-published .si-pill-dot { background: #16a34a; }

/* Tab bar inside SI detail modal */
.si-tabs { display: flex; border-bottom: 2px solid #e2e8f0; background: #fff; padding: 0 24px; flex-shrink: 0; }
.si-tab-btn {
  padding: 12px 20px; border: none; background: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: #64748b;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s; display: flex; align-items: center; gap: 6px;
}
.si-tab-btn:hover { color: #0f172a; }
.si-tab-btn.active { color: #7c3aed; border-bottom-color: #7c3aed; }

/* SI List Page */
.si-list-table { width: 100%; border-collapse: collapse; }
.si-list-table th {
  padding: 10px 16px; text-align: left; font-size: 0.72rem;
  font-weight: 700; text-transform: uppercase; color: #64748b;
  background: #f8fafc; border-bottom: 2px solid #e2e8f0;
}
.si-list-table td {
  padding: 14px 16px; border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem; vertical-align: middle;
}
.si-list-table tr:hover td { background: #f8fafc; cursor: pointer; }

/* Documents table inside SI detail */
.si-doc-row {
  display: grid;
  grid-template-columns: 2fr 110px 80px 110px 80px;
  gap: 0; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.si-doc-row:hover { background: #f8fafc; }
.si-doc-header {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  color: #94a3b8; letter-spacing: 0.06em;
  padding: 8px 16px; background: #f8fafc; border-bottom: 2px solid #e2e8f0;
  display: grid; grid-template-columns: 2fr 110px 80px 110px 80px;
}

/* Activity log entry */
.si-activity-entry {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #f8fafc; align-items: flex-start;
}
.si-activity-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.si-activity-entity-SI       { background: #ede9fe; color: #7c3aed; }
.si-activity-entity-DOCUMENT { background: #f0f9ff; color: #0369a1; }
.si-activity-entity-ISSUE    { background: #fef3c7; color: #92400e; }

/* Lock badge on drawing picker */
.lock-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.68rem; font-weight: 700;
  background: #fff1f2; color: #be123c; border: 1px solid #fecdd3;
  padding: 2px 7px; border-radius: 4px;
}

/* SI action footer bar */
.si-action-bar {
  padding: 14px 24px; border-top: 2px solid #e2e8f0;
  display: flex; gap: 10px; align-items: center;
  background: #f8fafc; flex-shrink: 0;
}

/* Promote-to-SI button (in issue detail panel) */
.btn-promote-si {
  background: #7c3aed; color: #fff; border: none;
  border-radius: 6px; padding: 5px 12px; font-size: 0.75rem;
  font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: background 0.2s;
}
.btn-promote-si:hover { background: #6d28d9; }

/* Linked SI block in issue detail */
.linked-si-block {
  grid-column: 1/-1; background: #faf5ff; border: 1px solid #e9d5ff;
  border-radius: 8px; padding: 10px 12px; margin-top: 4px; cursor: pointer;
  transition: background 0.15s;
}
.linked-si-block:hover { background: #f3e8ff; }

/* Full-page SI detail modal overlay */
#siDetailModal {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px); z-index: 1200;
  display: none; align-items: flex-start; justify-content: center;
  padding: 24px 16px; box-sizing: border-box;
}
#siDetailModal.active { display: flex; }
#siDetailModal .si-modal-inner {
  background: #fff; border-radius: 16px; width: 100%; max-width: 1060px;
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3); overflow: hidden;
  animation: slideUp 0.25s ease;
}
#siDetailModal .si-modal-header {
  padding: 20px 28px; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}
#siDetailModal .si-modal-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* Upload drop zone inside SI */
.si-upload-zone {
  border: 2px dashed #c4b5fd; border-radius: 10px;
  padding: 32px 20px; text-align: center; cursor: pointer; background: #faf5ff;
  transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.si-upload-zone svg,
.si-upload-zone i[data-lucide] {
  display: block; width: 36px; height: 36px; color: #7c3aed; margin-bottom: 6px; flex-shrink: 0;
}
.si-upload-zone:hover, .si-upload-zone.dragover {
  background: #f3e8ff; border-color: #7c3aed;
}



/* ==========================================
   SYNC PENDING — "Awaiting PM approval" badge
   Modern pill with animated clock icon
   ========================================== */
.badge-sync-pending {
   display: inline-flex;
   align-items: center;
   gap: 6px;
   background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
   color: #1e40af;
   border: 1px solid #93c5fd;
   padding: 5px 13px;
   border-radius: 20px;
   font-size: 0.72rem;
   font-weight: 700;
   letter-spacing: 0.025em;
   white-space: nowrap;
   box-shadow: 0 1px 4px rgba(59,130,246,0.15), inset 0 1px 0 rgba(255,255,255,0.6);
   transition: box-shadow 0.2s;
}
.badge-sync-pending i {
   width: 12px;
   height: 12px;
   flex-shrink: 0;
   animation: clockTick 2s ease-in-out infinite;
}
@keyframes clockTick {
   0%, 100% { transform: rotate(0deg); opacity: 1; }
   45%       { transform: rotate(12deg); opacity: 0.7; }
   55%       { transform: rotate(-12deg); opacity: 0.7; }
}

/* Success toast animation */
@keyframes siToastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

