/* ═══════════════════════════════════════════════════════════════
   KVPL — Custom styles layered over Bootstrap 5
   Font: Plus Jakarta Sans + IBM Plex Mono
   ═══════════════════════════════════════════════════════════════ */

:root {
  --kvpl-green:      #146c3c;
  --kvpl-green-mid:  #198a4a;
  --kvpl-green-lite: #22a75c;
  --kvpl-green-pale: #d6f0e0;
  --kvpl-sidebar:    #0f1923;
  --kvpl-sidebar2:   #182230;
  --kvpl-sidebar-border: rgba(255,255,255,.07);
  --kvpl-sidebar-text:   rgba(180,196,210,.7);
  --kvpl-sidebar-hi:     #e6edf3;
  --kvpl-sidebar-active: rgba(22,167,92,.18);
  --kvpl-sidebar-hover:  rgba(255,255,255,.06);
  --kvpl-sidebar-w:      240px;
  --kvpl-font:       'Plus Jakarta Sans', system-ui, sans-serif;
  --kvpl-mono:       'IBM Plex Mono', ui-monospace, monospace;
}

/* ── Fonts ────────────────────────────────────────────────────── */
body {
  font-family: var(--kvpl-font);
  background: #f3f5f8;
  font-size: 14px;
}

/* ═══ SIDEBAR ════════════════════════════════════════════════════ */
.kvpl-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--kvpl-sidebar-w);
  background: var(--kvpl-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform .25s ease;
  border-right: 1px solid var(--kvpl-sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--kvpl-sidebar-border);
  text-decoration: none;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--kvpl-green), var(--kvpl-green-lite));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(20,108,60,.4);
}
.brand-name {
  font-size: 16px; font-weight: 700;
  color: var(--kvpl-sidebar-hi);
  letter-spacing: -.2px;
  line-height: 1.2;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--kvpl-sidebar-text);
  letter-spacing: .2px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: rgba(180,196,210,.35);
  padding: 6px 10px 4px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--kvpl-sidebar-text);
  font-size: 13.5px; font-weight: 500;
  transition: all .15s;
  text-decoration: none;
}
.sidebar-nav .nav-link i {
  font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; opacity: .8;
}
.sidebar-nav .nav-link:hover {
  color: var(--kvpl-sidebar-hi);
  background: var(--kvpl-sidebar-hover);
}
.sidebar-nav .nav-link.active {
  color: #4ade80;
  background: var(--kvpl-sidebar-active);
  font-weight: 600;
}
.sidebar-nav .nav-link.active i { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--kvpl-sidebar-border);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: var(--kvpl-sidebar2);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--kvpl-green), var(--kvpl-green-lite));
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 12.5px; font-weight: 600; color: var(--kvpl-sidebar-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 10.5px; color: var(--kvpl-sidebar-text); }
.user-actions .btn-link { color: var(--kvpl-sidebar-text) !important; }
.user-actions .btn-link:hover { color: var(--kvpl-sidebar-hi) !important; }
.user-menu-btn {
  color: var(--kvpl-sidebar-text) !important;
  font-size: 15px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background .15s, color .15s;
  text-decoration: none !important;
}
.user-menu-btn:hover {
  color: var(--kvpl-sidebar-hi) !important;
  background: var(--kvpl-sidebar-hover);
}

/* Icon buttons — show text label alongside icon for accessibility */
.btn-icon-label { font-size: 11px; }

/* ── Icon font fallback: if Bootstrap Icons fail to load, show text labels ── */
.btn-icon-edit::before   { content: '✎ '; font-style: normal; }
.btn-icon-delete::before { content: '🗑 '; font-style: normal; }

/* Mobile */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 1025;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }
.kvpl-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1020;
  height: 52px; background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center;
  gap: 12px; padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

@media (max-width: 991.98px) {
  .kvpl-sidebar { transform: translateX(-100%); }
  .kvpl-sidebar.open { transform: translateX(0); }
}

/* ═══ MAIN CONTENT ═══════════════════════════════════════════════ */
.kvpl-main {
  margin-left: var(--kvpl-sidebar-w);
  min-height: 100vh;
  transition: margin .25s ease;
}
.content-wrapper {
  padding: 24px 28px 48px;
  /* No max-width: use full available width */
}

@media (max-width: 991.98px) {
  .kvpl-main { margin-left: 0; }
  .content-wrapper { padding: 60px 12px 24px; }
}

/* ═══ PAGE HEADER ════════════════════════════════════════════════ */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}
.page-title { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -.3px; line-height: 1.2; }
.page-title small { display: block; font-size: 13px; font-weight: 400; color: #64748b; margin-top: 3px; }

/* ═══ CARDS ══════════════════════════════════════════════════════ */
.kvpl-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  overflow: hidden;
}
.kvpl-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.kvpl-card-title { font-size: 13.5px; font-weight: 600; color: #0f172a; }
.kvpl-card-body  { padding: 20px; }

/* ═══ STAT CARDS ═════════════════════════════════════════════════ */
.stat-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 14px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
}
.stat-green::before  { background: linear-gradient(90deg, var(--kvpl-green), var(--kvpl-green-lite)); }
.stat-red::before    { background: linear-gradient(90deg, #dc2626, #ef4444); }
.stat-amber::before  { background: linear-gradient(90deg, #d97706, #f59e0b); }
.stat-blue::before   { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
.stat-purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 14px;
}
.stat-green .stat-icon  { background: #dcfce7; color: var(--kvpl-green); }
.stat-red .stat-icon    { background: #fee2e2; color: #dc2626; }
.stat-amber .stat-icon  { background: #fef3c7; color: #d97706; }
.stat-blue .stat-icon   { background: #dbeafe; color: #1d4ed8; }
.stat-purple .stat-icon { background: #ede9fe; color: #7c3aed; }

.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -1.5px; color: #0f172a; line-height: 1; }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: #64748b; margin-top: 6px; }
.stat-sub   { font-size: 12px; color: #94a3b8; margin-top: 4px; }

/* ═══ FACTORY CARDS ══════════════════════════════════════════════ */
.factory-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 1px 4px rgba(0,0,0,.05);
  position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.factory-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.factory-card::after {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: 14px 0 0 14px;
}
.fc-DE::after { background: #16a34a; }
.fc-PW::after { background: #2563eb; }
.fc-CF::after { background: #7c3aed; }
.fc-LV::after { background: #d97706; }
.fc-DD::after { background: #dc2626; }

/* ═══ FACTORY CHIPS ══════════════════════════════════════════════ */
.fchip {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 5px;
  font-size: 11.5px; font-weight: 700;
  font-family: var(--kvpl-mono); letter-spacing: .4px;
}
.fchip-DE { background: #dcfce7; color: #14532d; }
.fchip-PW { background: #dbeafe; color: #1e3a8a; }
.fchip-CF { background: #ede9fe; color: #4c1d95; }
.fchip-LV { background: #fef3c7; color: #78350f; }
.fchip-DD { background: #fee2e2; color: #7f1d1d; }

/* Keep old class names working */
.factory-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 5px; font-size: 11.5px; font-weight: 700; font-family: var(--kvpl-mono); letter-spacing: .4px; }
.fchip-DE.factory-chip, .fchip-PW.factory-chip, .fchip-CF.factory-chip, .fchip-LV.factory-chip, .fchip-DD.factory-chip { }
.fchip-DE { background: #dcfce7; color: #14532d; }
.fchip-PW { background: #dbeafe; color: #1e3a8a; }
.fchip-CF { background: #ede9fe; color: #4c1d95; }
.fchip-LV { background: #fef3c7; color: #78350f; }
.fchip-DD { background: #fee2e2; color: #7f1d1d; }

/* ═══ TABLES ═════════════════════════════════════════════════════ */
.kvpl-table-wrap { overflow-x: auto; border-radius: 0 0 14px 14px; }
.kvpl-table { width: 100%; border-collapse: collapse; }
.kvpl-table thead th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: #64748b; background: #f8fafc;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.kvpl-table tbody td {
  padding: 11px 16px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle; font-size: 13.5px; color: #1e293b;
}
.kvpl-table tbody tr:last-child td { border-bottom: none; }
.kvpl-table tbody tr { transition: background .1s; }
.kvpl-table tbody tr:hover { background: #f8fafc; }
.kvpl-table tfoot td {
  padding: 9px 12px; border-top: 2px solid #e2e8f0;
  font-weight: 700; background: #f1f5f9; font-size: 12.5px;
}

/* Table link */
.tlink { color: var(--kvpl-green); font-weight: 600; text-decoration: none; }
.tlink:hover { color: var(--kvpl-green-mid); text-decoration: underline; }

/* Mono numbers */
.mono-num { font-family: var(--kvpl-mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ═══ BADGES ═════════════════════════════════════════════════════ */
.kvpl-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}

/* Map old badge classes */
.badge-open    { background: #dcfce7; color: #14532d; }
.badge-closed  { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-overdue { background: #fee2e2; color: #b91c1c; }
.badge-cf      { background: #ede9fe; color: #6d28d9; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #14532d; }
.badge-error   { background: #fee2e2; color: #b91c1c; }

/* Role badges */
.role-admin  { background: #dcfce7; color: #14532d; }
.role-editor { background: #dbeafe; color: #1e3a8a; }
.role-viewer { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* Audit */
.audit-action { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; background: #f1f5f9; color: #475569; }
.audit-create { background: #dcfce7; color: #14532d; }
.audit-edit   { background: #dbeafe; color: #1e3a8a; }
.audit-delete { background: #fee2e2; color: #b91c1c; }
.audit-login  { background: #fef3c7; color: #92400e; }
.audit-toggle { background: #ede9fe; color: #6d28d9; }

/* ═══ BUTTONS ════════════════════════════════════════════════════ */
.btn-kvpl-primary {
  background: var(--kvpl-green); color: #fff;
  border: none; border-radius: 8px;
  font-family: var(--kvpl-font); font-size: 13.5px; font-weight: 600;
  padding: 8px 18px;
  box-shadow: 0 2px 8px rgba(20,108,60,.25);
  transition: all .15s;
}
.btn-kvpl-primary:hover { background: var(--kvpl-green-mid); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(20,108,60,.3); }

.btn-kvpl-outline {
  background: #fff; color: #374151;
  border: 1.5px solid #d1d5db; border-radius: 8px;
  font-family: var(--kvpl-font); font-size: 13.5px; font-weight: 600;
  padding: 7px 18px; transition: all .15s;
}
.btn-kvpl-outline:hover { background: #f9fafb; border-color: #9ca3af; color: #111827; }

/* Override Bootstrap button defaults for templates using old classes */
.btn-primary  { background: var(--kvpl-green); border-color: var(--kvpl-green); font-family: var(--kvpl-font); font-weight: 600; border-radius: 8px; }
.btn-primary:hover, .btn-primary:focus { background: var(--kvpl-green-mid); border-color: var(--kvpl-green-mid); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(20,108,60,.25); }
.btn-outline-secondary { font-family: var(--kvpl-font); font-weight: 600; border-radius: 8px; }
.btn-outline { background: #fff; color: #374151; border: 1.5px solid #d1d5db; border-radius: 8px; font-family: var(--kvpl-font); font-weight: 600; }
.btn-outline:hover { background: #f9fafb; border-color: #9ca3af; color: #111827; }
.btn-danger  { font-family: var(--kvpl-font); font-weight: 600; border-radius: 8px; }
.btn-warn    { background: #d97706; color: #fff; border-color: #d97706; font-family: var(--kvpl-font); font-weight: 600; border-radius: 8px; }
.btn-sm      { font-size: 12px !important; padding: 4px 12px !important; }

/* ═══ FORMS ══════════════════════════════════════════════════════ */
.form-label {
  font-size: 12.5px; font-weight: 600; color: #374151;
  margin-bottom: 5px;
}
.form-control, .form-select {
  border: 1.5px solid #d1d5db; border-radius: 8px;
  font-family: var(--kvpl-font); font-size: 13.5px; color: #111827;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--kvpl-green);
  box-shadow: 0 0 0 3px rgba(20,108,60,.15);
}
.form-control:disabled, .form-select:disabled {
  background: #f9fafb; color: #6b7280;
}
.form-control::placeholder { color: #9ca3af; }
.form-text { font-size: 12px; color: #6b7280; }

/* ═══ TABS ═══════════════════════════════════════════════════════ */
.kvpl-tabs { border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.kvpl-tab {
  background: none; border: none;
  font-family: var(--kvpl-font); font-size: 13.5px; font-weight: 500;
  color: #64748b; padding: 10px 18px;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; transition: all .15s; border-radius: 0;
}
.kvpl-tab:hover { color: #1e293b; }
.kvpl-tab.active { color: var(--kvpl-green); border-bottom-color: var(--kvpl-green); font-weight: 700; }

/* ═══ PROGRESS ═══════════════════════════════════════════════════ */
.kvpl-progress { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.kvpl-progress-bar { height: 100%; background: linear-gradient(90deg, var(--kvpl-green), var(--kvpl-green-lite)); border-radius: 999px; transition: width .4s ease; }
.kvpl-progress-bar.danger { background: linear-gradient(90deg, #dc2626, #ef4444); }
.kvpl-progress-bar.cf-over { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

/* Keep old classes working */
.progress-bar { background: var(--kvpl-green-lite); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--kvpl-green), var(--kvpl-green-lite)); border-radius: 999px; }
.progress-fill.overdue, .progress-fill.danger { background: linear-gradient(90deg, #dc2626, #ef4444); }
.progress-fill.cf-over { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

/* ═══ OLD CLASS COMPATIBILITY ════════════════════════════════════ */
/* These map old template classes to new Bootstrap/custom styles */
.page-header    { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; }
.page-title     { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -.3px; line-height: 1.2; }
.page-title small { display: block; font-size: 13px; font-weight: 400; color: #64748b; margin-top: 3px; }

.card           { border: 1px solid #e2e8f0 !important; border-radius: 14px !important; box-shadow: 0 1px 4px rgba(0,0,0,.05) !important; overflow: hidden; }
.card-header    { background: #f8fafc !important; border-bottom: 1px solid #e2e8f0 !important; padding: 14px 20px !important; }
.card-title     { font-size: 13.5px; font-weight: 600; color: #0f172a; }
.card-body      { padding: 20px !important; }

.stats-grid         { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card          { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.05); position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.stat-card:hover    { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.stat-label         { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: #64748b; margin-bottom: 6px; }
.stat-value         { font-size: 28px; font-weight: 700; letter-spacing: -1px; color: #0f172a; line-height: 1; }
.stat-value.accent  { color: var(--kvpl-green); }
.stat-value.danger  { color: #dc2626; }
.stat-value.warn    { color: #d97706; }
.stat-sub           { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.factory-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-bottom: 24px; }
.factory-card-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-left: 8px; }
.factory-card-name    { font-size: 13px; font-weight: 600; color: #0f172a; }
.factory-card-stats   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 12px; padding-left: 8px; }
.fcs-item { text-align: center; background: #f8fafc; border-radius: 6px; padding: 6px 2px; }
.fcs-val  { font-size: 20px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.fcs-val.accent { color: var(--kvpl-green); }
.fcs-val.danger { color: #dc2626; }
.fcs-lbl  { font-size: 9.5px; text-transform: uppercase; letter-spacing: .6px; color: #94a3b8; margin-top: 2px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table       { width: 100%; border-collapse: collapse; }
thead tr    { background: #f8fafc; }
th          { padding: 9px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #64748b; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
td          { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; font-size: 13px; color: #1e293b; white-space: nowrap; }
td.td-wrap  { white-space: normal; word-break: break-word; }
tr:last-child td { border-bottom: none; }
tbody tr    { transition: background .1s; }
tbody tr:hover { background: #f8fafc; }
.total-row td { font-weight: 700; background: #f1f5f9 !important; border-top: 2px solid #e2e8f0; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.role-badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }

.filters-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.filters-bar select, .filters-bar input[type=month], .filters-bar input[type=text] { border: 1.5px solid #d1d5db; border-radius: 8px; padding: 6px 10px; font-family: var(--kvpl-font); font-size: 13px; background: #f9fafb; color: #111827; outline: none; transition: border-color .15s, box-shadow .15s; }
.filters-bar select:focus, .filters-bar input:focus { border-color: var(--kvpl-green); box-shadow: 0 0 0 3px rgba(20,108,60,.12); }
.filters-bar input[type=text] { flex: 1; min-width: 180px; }
.filters-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #94a3b8; white-space: nowrap; }

.tabs { display: flex; margin-bottom: 18px; border-bottom: 2px solid #e2e8f0; }
.tab-btn { background: none; border: none; font-family: var(--kvpl-font); font-size: 13.5px; font-weight: 500; color: #64748b; padding: 10px 18px; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: all .15s; }
.tab-btn:hover { color: #1e293b; }
.tab-btn.active { color: var(--kvpl-green); border-bottom-color: var(--kvpl-green); font-weight: 700; }

.detail-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px,1fr)); gap: 12px; margin-bottom: 16px; }
.detail-item  { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.detail-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #94a3b8; margin-bottom: 4px; font-weight: 700; }
.detail-value { font-size: 14px; font-weight: 600; color: #0f172a; }

.delivery-add-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; align-items: end; }

.alloc-row, .material-row { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.alloc-row select, .alloc-row input, .material-row select, .material-row input { border: 1.5px solid #d1d5db; border-radius: 8px; padding: 7px 10px; font-family: var(--kvpl-font); font-size: 13.5px; background: #fff; color: #111827; outline: none; transition: border-color .15s, box-shadow .15s; }
.alloc-row select:focus, .alloc-row input:focus, .material-row select:focus, .material-row input:focus { border-color: var(--kvpl-green); box-shadow: 0 0 0 3px rgba(20,108,60,.12); }
.alloc-factory-sel { flex: 2; }
.alloc-qty-inp { flex: 1; }

.alert { border-radius: 10px; font-size: 13.5px; font-family: var(--kvpl-font); }
.alert-success { background: #dcfce7; color: #14532d; border-color: rgba(20,108,60,.2); }
.alert-danger, .alert-error { background: #fee2e2; color: #b91c1c; border-color: rgba(220,38,38,.2); }
.alert-warning, .alert-warn { background: #fef3c7; color: #92400e; border-color: rgba(217,119,6,.2); }
.alert-info    { background: #dbeafe; color: #1e3a8a; border-color: rgba(37,99,235,.2); }

.modal-content { border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 20px 48px rgba(0,0,0,.15); }
.modal-header  { border-bottom: 1px solid #e2e8f0; padding: 16px 20px; background: #f8fafc; border-radius: 16px 16px 0 0; }
.modal-title   { font-size: 16px; font-weight: 700; color: #0f172a; }
.modal-body    { padding: 20px; }
.modal-footer  { border-top: 1px solid #e2e8f0; padding: 12px 20px; background: #f8fafc; border-radius: 0 0 16px 16px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); z-index: 1050; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; box-shadow: 0 20px 48px rgba(0,0,0,.15); width: 100%; max-width: 520px; padding: 24px; margin: 16px; border: 1px solid #e2e8f0; }
.modal-title { font-weight: 700; font-size: 16px; margin-bottom: 16px; color: #0f172a; }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0; }
.form-group label { font-size: 12.5px; font-weight: 600; color: #374151; }
.form-group input, .form-group select, .form-group textarea { border: 1.5px solid #d1d5db; border-radius: 8px; padding: 8px 12px; font-family: var(--kvpl-font); font-size: 13.5px; color: #111827; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--kvpl-green); box-shadow: 0 0 0 3px rgba(20,108,60,.12); }
.form-group input:disabled, .form-group select:disabled { background: #f9fafb; color: #6b7280; }
.form-group input::placeholder, .form-group textarea::placeholder { color: #9ca3af; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 16px; }
.form-hint { font-size: 12px; color: #6b7280; }

.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12.5px; }
.text-muted { color: #64748b !important; }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px !important; }
.mb-6 { margin-bottom: 24px !important; }
.number { font-family: var(--kvpl-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.empty-state { padding: 40px; text-align: center; color: #64748b; font-size: 13.5px; }
.print-only { display: none; }
.no-print {}

.report-section { margin-bottom: 10px; }
.report-factory-header { display: flex; align-items: center; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid #e2e8f0; }
.report-grand-total { margin-bottom: 8px; }

/* ═══ PRINT ══════════════════════════════════════════════════════ */
@media print {
  @page { size: A4 landscape; margin: 12mm 10mm; }
  .kvpl-sidebar, .kvpl-topbar, .no-print, .sidebar-backdrop { display: none !important; }
  .kvpl-main { margin-left: 0 !important; }
  .content-wrapper { padding: 0 !important; max-width: 100% !important; }
  body { background: white !important; font-size: 11.5px; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: avoid; border-radius: 0 !important; }
  th { background: #eee !important; font-size: 10px; }
  td { font-size: 11px; padding: 5px 8px; }
  .factory-chip, .badge { border: 1px solid #ccc !important; background: #f0f0f0 !important; color: #333 !important; }
  a { color: inherit; text-decoration: none; }
  .print-only { display: block !important; }
  .kvpl-progress, .progress-bar { display: none; }
  .alloc-row, .material-row { background: none !important; border: none !important; }
  .report-section { page-break-inside: avoid; }
  .report-grand-total { border-width: 1.5px !important; }
}

/* ═══ RESPONSIVE ═════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .factory-summary-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; gap: 10px; }
  th, td { padding: 8px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .delivery-add-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 575.98px) {
  .factory-summary-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .delivery-add-form { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}

/* ═══ PAGINATION ═════════════════════════════════════════════════ */
.page-link {
  font-family: var(--kvpl-font);
  font-size: 13px;
  color: var(--kvpl-green);
  border-color: #e2e8f0;
}
.page-link:hover { background: #dcfce7; color: var(--kvpl-green); border-color: #e2e8f0; }
.page-item.active .page-link { background: var(--kvpl-green); border-color: var(--kvpl-green); }

/* ═══ BREADCRUMB ═════════════════════════════════════════════════ */
.kvpl-breadcrumb {
  font-size: 12.5px; color: #94a3b8; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.kvpl-breadcrumb a { color: #64748b; text-decoration: none; }
.kvpl-breadcrumb a:hover { color: var(--kvpl-green); text-decoration: underline; }
.kvpl-breadcrumb .sep { color: #cbd5e1; }
.kvpl-breadcrumb .current { color: #1e293b; font-weight: 600; }

/* ═══ EMPTY STATE IMPROVED ═══════════════════════════════════════ */
.empty-state-full {
  padding: 60px 24px;
  text-align: center;
}
.empty-state-full i { font-size: 48px; color: #e2e8f0; display: block; margin-bottom: 16px; }
.empty-state-full h6 { font-weight: 600; color: #475569; margin-bottom: 6px; }
.empty-state-full p { color: #94a3b8; font-size: 13.5px; margin-bottom: 20px; }

/* ═══ OVERDUE ROW HIGHLIGHT ══════════════════════════════════════ */
tr.row-overdue td { background: #fff5f5 !important; }
tr.row-overdue td:first-child { border-left: 3px solid #dc2626; }

/* ═══ TOOLTIP FIXES ══════════════════════════════════════════════ */
[data-bs-toggle="tooltip"] { cursor: help; }

/* ═══ CODE / MONO ════════════════════════════════════════════════ */
code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
  color: #374151;
}

/* ═══ FORM SECTION DIVIDER ═══════════════════════════════════════ */
.form-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
  margin-top: 20px;
}
.form-section-label {
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: #64748b; margin-bottom: 16px;
}

/* ═══ TOTAL QTY DISPLAY ══════════════════════════════════════════ */
.total-qty-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-top: 10px;
}
.total-qty-bar span:first-child { font-size: 13px; color: #64748b; }
.total-qty-bar strong { font-size: 16px; font-weight: 700; color: var(--kvpl-green); font-family: var(--kvpl-mono); }

/* ═══ STATUS PILL OVERDUE ════════════════════════════════════════ */
.badge-overdue-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fee2e2; color: #b91c1c;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

/* ═══ STAT CARD STRIPE (explicit div, not just ::before) ════════ */
.stat-card-stripe {
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: 14px 14px 0 0;
}
.stat-green .stat-card-stripe  { background: linear-gradient(90deg, var(--kvpl-green), var(--kvpl-green-lite)); }
.stat-red .stat-card-stripe    { background: linear-gradient(90deg, #dc2626, #ef4444); }
.stat-amber .stat-card-stripe  { background: linear-gradient(90deg, #d97706, #f59e0b); }
.stat-blue .stat-card-stripe   { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
.stat-purple .stat-card-stripe { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

/* ── Report table: unified font size on screen ── */
.report-table { font-size: 11px; }
.report-table th { font-size: 11px; }
.report-table td { font-size: 11px; }
.report-table .number { font-size: 11px; }
.report-table .due-date-cell { white-space: nowrap; font-size: 11px; }

/* ── Print: full width, no sidebar ── */
@media print {
  .kvpl-sidebar, .kvpl-topbar, .no-print, .sidebar-backdrop,
  .page-header, .filters-bar, .print-only-hidden { display: none !important; }
  .kvpl-main { margin-left: 0 !important; }
  .content-wrapper { padding: 0 !important; }
  body { background: white !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important;
          page-break-inside: avoid; border-radius: 4px !important; }
  .card-header { background: #f5f5f5 !important; padding: 6px 10px !important; }
  /* Single unified font size for ALL table content in print */
  .report-table,
  .report-table th,
  .report-table td,
  .report-table .number,
  .report-table .due-date-cell { font-size: 9px !important; }
  .report-table th { background: #eee !important; padding: 4px 6px !important; white-space: normal !important; }
  .report-table td { padding: 3px 6px !important; white-space: normal !important; }
  /* Due date and numbers must never wrap in print */
  .report-table .due-date-cell,
  .report-table .number { white-space: nowrap !important; overflow: visible !important; }
  .factory-chip, .badge { border: 1px solid #ccc !important;
    background: #f0f0f0 !important; color: #333 !important; font-size: 9px !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .kvpl-progress, .progress-bar { display: none !important; }
  table { table-layout: fixed !important; width: 100% !important; }
  .report-section { page-break-inside: avoid; }
  /* Monthly total highlight preserved in print */
  .monthly-total-row { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* Grade-level pricing and allocation transfer upgrade */
.grade-row {display:grid;grid-template-columns:minmax(220px,2fr) minmax(130px,1fr) minmax(130px,1fr) 100px 42px;gap:10px;align-items:center;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:10px 12px;margin-bottom:8px}
.grade-row-header,.alloc-row-header{background:transparent;border:0;padding:0 12px 6px;margin:0;color:#64748b;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.alloc-row-header{grid-template-columns:minmax(220px,1.5fr) minmax(220px,1.5fr) minmax(140px,1fr) 42px}
.grade-row select,.grade-row input{border:1.5px solid #d1d5db;border-radius:8px;padding:7px 10px;font-family:var(--kvpl-font);font-size:13.5px;background:#fff;color:#111827;outline:none}
.grade-row select:focus,.grade-row input:focus{border-color:var(--kvpl-green);box-shadow:0 0 0 3px rgba(20,108,60,.12)}
.transfer-form{display:grid;grid-template-columns:2fr 1.2fr 1.2fr 1fr 1.2fr 2fr auto;gap:10px;align-items:end}
.transfer-flow{font-family:var(--kvpl-mono);font-weight:700;color:#334155}
.status-reversed{opacity:.6;text-decoration:line-through}
@media(max-width:900px){.grade-row,.transfer-form{grid-template-columns:1fr 1fr}.grade-row .remove-grade-btn,.transfer-form button{grid-column:auto}.alloc-row-header,.grade-row-header{display:none!important}}
@media(max-width:600px){.grade-row,.transfer-form{grid-template-columns:1fr}}
.alloc-row-header{display:grid!important}

/* Phase 2 – workflow and amendment UI */
.badge-draft{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}
.badge-pending_approval,.badge-pending{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa}
.badge-approved{background:#ecfeff;color:#155e75;border:1px solid #a5f3fc}
.badge-active{background:#dcfce7;color:#14532d;border:1px solid #bbf7d0}
.badge-partially_delivered{background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe}
.badge-completed{background:#f0fdf4;color:#166534;border:1px solid #bbf7d0}
.badge-on_hold{background:#fef3c7;color:#92400e;border:1px solid #fde68a}
.badge-cancelled,.badge-rejected{background:#fef2f2;color:#991b1b;border:1px solid #fecaca}
.badge-closed{background:#f1f5f9;color:#475569;border:1px solid #e2e8f0}
.badge-operational{background:#ecfdf5;color:#065f46;border:1px solid #a7f3d0}
.workflow-tabs{overflow-x:auto;white-space:nowrap;padding-bottom:2px}
.workflow-timeline{padding:18px 20px}
.workflow-event{position:relative;display:grid;grid-template-columns:18px 1fr;gap:12px;padding-bottom:18px}
.workflow-event:not(:last-child)::before{content:"";position:absolute;left:6px;top:14px;bottom:0;width:2px;background:#dbeafe}
.workflow-dot{width:14px;height:14px;border-radius:50%;background:var(--kvpl-green);box-shadow:0 0 0 4px #dcfce7;margin-top:3px;z-index:1}
.comparison-changed td{background:#fff7ed}
.comparison-changed td:first-child{border-left:3px solid #f59e0b}
.amendment-reason{border:1px solid #bfdbfe;background:#eff6ff}
.grade-row{grid-template-columns:minmax(190px,2fr) minmax(105px,1fr) minmax(105px,1fr) 82px minmax(88px,.8fr) minmax(88px,.8fr) minmax(110px,1fr) 42px}
@media(max-width:1200px){.grade-row{grid-template-columns:repeat(4,minmax(140px,1fr));overflow-x:auto}.grade-row .remove-grade-btn{justify-self:start}.grade-row-header{display:none!important}}
@media(max-width:700px){.grade-row{grid-template-columns:1fr 1fr}.workflow-event{grid-template-columns:14px 1fr}}

/* Phase 2 V2 – managed commercial data and documents */
.contract-section-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
}
.detail-grid-wide { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.contract-text-block { border-top: 1px solid #e2e8f0; white-space: pre-wrap; }
.internal-note { background:#fffaf0; border:1px solid #fde7b0; border-radius:10px; padding:12px 14px!important; }
.document-upload-grid { display:grid; grid-template-columns:1fr 1.4fr 1.5fr auto; gap:14px; align-items:end; }
.document-type-pill { display:inline-flex; padding:4px 9px; border-radius:999px; background:#eef6f1; color:#17633a; font-size:12px; font-weight:600; }
.document-link { font-weight:600; word-break:break-word; }
.row-inactive { opacity:.62; background:#f8fafc; }
.customer-form-grid { display:grid; gap:14px; }
.master-tabs { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; }
.master-tab { display:flex; align-items:center; gap:8px; padding:10px 14px; border:1px solid #dce4df; border-radius:10px; background:#fff; color:#334155; text-decoration:none; font-weight:600; }
.master-tab:hover { border-color:#8cb99f; color:#17633a; }
.master-tab.active { background:#17633a; border-color:#17633a; color:#fff; }
.master-tab span { min-width:22px; text-align:center; padding:1px 6px; border-radius:999px; background:rgba(148,163,184,.18); font-size:11px; }
.master-tab.active span { background:rgba(255,255,255,.18); }
.master-edit-row td { background:#f8fafc; padding:18px!important; }
.master-inline-form { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; align-items:end; }
@media (max-width: 992px) {
  .document-upload-grid { grid-template-columns:1fr 1fr; }
}
@media (max-width: 576px) {
  .document-upload-grid { grid-template-columns:1fr; }
  .contract-section-card { padding:14px; }
}

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 – INDUSTRIAL CONTROL INTERFACE
   Additive layer: legacy screen classes remain supported.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --industrial-ink: #0b161f;
  --industrial-ink-2: #12232e;
  --industrial-steel: #243946;
  --industrial-line: #d9e2e8;
  --industrial-canvas: #eef2f4;
  --industrial-panel: #ffffff;
  --industrial-muted: #657681;
  --industrial-green: #087a43;
  --industrial-lime: #54b948;
  --industrial-amber: #c97708;
  --industrial-red: #c82f3f;
  --industrial-blue: #1769aa;
  --kvpl-sidebar-w: 264px;
}

body.kvpl-industrial-shell {
  color: #172832;
  background:
    linear-gradient(rgba(25, 50, 63, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 50, 63, .025) 1px, transparent 1px),
    var(--industrial-canvas);
  background-size: 28px 28px;
}

.kvpl-industrial-shell .kvpl-sidebar {
  background:
    radial-gradient(circle at 30% 0, rgba(25, 138, 74, .16), transparent 35%),
    linear-gradient(180deg, #0a151d 0%, #0d1d27 52%, #0a161e 100%);
  border-right: 1px solid rgba(145, 177, 195, .15);
  box-shadow: 12px 0 34px rgba(8, 23, 32, .10);
}

.kvpl-industrial-shell .sidebar-brand {
  min-height: 76px;
  padding: 17px 18px;
  gap: 13px;
  position: relative;
}
.kvpl-industrial-shell .sidebar-brand::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, rgba(84,185,72,.8), rgba(84,185,72,0));
}
.kvpl-industrial-shell .brand-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
}
.kvpl-industrial-shell .brand-icon i {
  position: absolute;
  inset: 0;
  color: var(--industrial-green);
  font-size: 39px;
  line-height: 40px;
  filter: drop-shadow(0 4px 10px rgba(8,122,67,.3));
}
.kvpl-industrial-shell .brand-icon span {
  position: relative;
  z-index: 1;
  color: #fff;
  font-family: var(--kvpl-mono);
  font-size: 14px;
  font-weight: 600;
}
.kvpl-industrial-shell .brand-name {
  font-size: 17px;
  letter-spacing: 1.8px;
  font-family: var(--kvpl-mono);
}
.kvpl-industrial-shell .brand-sub {
  color: rgba(205, 220, 229, .56);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .65px;
  margin-top: 2px;
}

.system-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 3px;
  padding: 8px 10px;
  border: 1px solid rgba(84, 185, 72, .16);
  background: rgba(84, 185, 72, .055);
  color: rgba(211, 225, 232, .67);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .55px;
  border-radius: 5px;
}
.system-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #54d36b;
  box-shadow: 0 0 0 4px rgba(84, 211, 107, .10), 0 0 12px rgba(84, 211, 107, .7);
}
.system-state-code {
  margin-left: auto;
  color: #64d77a;
  font-family: var(--kvpl-mono);
  font-weight: 600;
}

.kvpl-industrial-shell .sidebar-nav {
  padding: 12px 11px;
}
.kvpl-industrial-shell .nav-section-label {
  color: rgba(171, 194, 207, .38);
  font-size: 9px;
  letter-spacing: 1.35px;
  padding-left: 11px;
}
.kvpl-industrial-shell .sidebar-nav .nav-link {
  border-radius: 5px;
  padding: 9px 11px;
  color: rgba(199, 216, 225, .65);
  border-left: 2px solid transparent;
  font-size: 12.5px;
}
.kvpl-industrial-shell .sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.045);
  border-left-color: rgba(84,185,72,.35);
}
.kvpl-industrial-shell .sidebar-nav .nav-link.active {
  color: #effff1;
  background: linear-gradient(90deg, rgba(8,122,67,.28), rgba(8,122,67,.08));
  border-left-color: #54b948;
  box-shadow: inset 0 0 0 1px rgba(84,185,72,.08);
}
.kvpl-industrial-shell .sidebar-nav .nav-link.active i { color: #65d45d; }
.kvpl-industrial-shell .sidebar-footer { border-top-color: rgba(145,177,195,.12); }
.kvpl-industrial-shell .user-card {
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(145,177,195,.10);
  border-radius: 6px;
}
.kvpl-industrial-shell .user-avatar { border-radius: 5px; background: #087a43; }
.sidebar-version {
  margin-top: 9px;
  text-align: center;
  color: rgba(174, 198, 211, .34);
  font: 9px var(--kvpl-mono);
  letter-spacing: .25px;
}

.command-bar {
  height: 58px;
  padding: 0 28px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid #d6e0e6;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1010;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(13, 36, 48, .04);
}
.command-context,
.command-actions { display: flex; align-items: center; gap: 12px; }
.command-eyebrow {
  color: var(--industrial-green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.command-divider { width: 1px; height: 18px; background: #d8e1e6; }
.command-module { color: #586b76; font-size: 12px; font-weight: 600; }
.command-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #435965;
  border: 1px solid #d9e2e7;
  background: #fff;
  border-radius: 5px;
  text-decoration: none;
}
.command-icon:hover { color: var(--industrial-green); border-color: #a9c7b6; }

.global-search { position: relative; width: min(410px, 32vw); }
.global-search > i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #7a8c96;
  font-size: 13px;
  pointer-events: none;
}
.global-search input {
  width: 100%;
  height: 34px;
  padding: 0 57px 0 32px;
  border: 1px solid #d5e0e6;
  border-radius: 5px;
  background: #f8fafb;
  color: #1c303a;
  font-size: 11.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.global-search input:focus {
  background: #fff;
  border-color: #7fb398;
  box-shadow: 0 0 0 3px rgba(8,122,67,.09);
}
.global-search kbd {
  position: absolute;
  right: 8px;
  top: 7px;
  padding: 2px 5px;
  border: 1px solid #d6e0e6;
  background: #fff;
  color: #84939b;
  box-shadow: none;
  font: 9px var(--kvpl-mono);
}
.global-search-results {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d4dfe5;
  border-radius: 7px;
  box-shadow: 0 18px 42px rgba(10, 28, 38, .16);
  z-index: 1080;
}
.global-search-item {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  color: #1c303a;
  text-decoration: none;
  border-bottom: 1px solid #edf1f3;
}
.global-search-item:last-child { border-bottom: 0; }
.global-search-item:hover { background: #f3f8f5; }
.global-search-mark {
  width: 34px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #112631;
  color: #ecf6f1;
  border-radius: 4px;
  font: 600 10px var(--kvpl-mono);
}
.global-search-copy { min-width: 0; display: flex; flex-direction: column; }
.global-search-copy strong { font: 600 11.5px var(--kvpl-mono); }
.global-search-copy small { color: #71838d; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search-status { color: #677a84; font-size: 9px; text-transform: uppercase; letter-spacing: .4px; }
.global-search-empty { padding: 17px; color: #71838d; text-align: center; font-size: 11px; }

.kvpl-industrial-shell .content-wrapper { padding: 25px 28px 48px; }
.kvpl-industrial-shell .page-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-color: var(--industrial-line);
}
.kvpl-industrial-shell .page-title { font-size: 20px; }
.kvpl-industrial-shell .card,
.kvpl-industrial-shell .kvpl-card {
  border-radius: 7px !important;
  border-color: #d8e1e6 !important;
  box-shadow: 0 3px 10px rgba(13, 36, 48, .045) !important;
}
.kvpl-industrial-shell .card-header,
.kvpl-industrial-shell .kvpl-card-header {
  border-color: #d8e1e6 !important;
  background: #f5f8f9 !important;
}
.kvpl-industrial-shell .btn { border-radius: 5px; font-size: 12px; font-weight: 600; }
.kvpl-industrial-shell .btn-primary {
  background: #087a43;
  border-color: #087a43;
  box-shadow: 0 3px 8px rgba(8,122,67,.16);
}
.kvpl-industrial-shell .btn-primary:hover { background: #076b3b; border-color: #076b3b; }
.kvpl-industrial-shell .form-control,
.kvpl-industrial-shell .form-select,
.kvpl-industrial-shell .form-group input,
.kvpl-industrial-shell .form-group select,
.kvpl-industrial-shell .form-group textarea {
  border-radius: 5px;
}

.management-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 5px 0 19px;
  border-bottom: 1px solid #cfdbe1;
}
.management-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #60737e;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.25px;
  margin-bottom: 7px;
}
.management-kicker span { width: 21px; height: 2px; background: var(--industrial-green); }
.management-head h1 {
  margin: 0;
  color: #10232d;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.55px;
}
.management-head p { margin: 5px 0 0; color: #6c7d86; font-size: 11.5px; }
.management-head-actions { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.factory-scope-form { display: flex; flex-direction: column; gap: 4px; min-width: 224px; }
.factory-scope-form label {
  color: #6b7d87;
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
}
.factory-scope-form select {
  height: 32px;
  border: 1px solid #cbd8de;
  border-radius: 5px;
  background: #fff;
  color: #263a45;
  padding: 0 29px 0 10px;
  font-size: 11px;
  outline: none;
}
.factory-scope-form select:focus { border-color: #70a98b; box-shadow: 0 0 0 3px rgba(8,122,67,.08); }
.dashboard-meta-strip {
  display: flex;
  gap: 22px;
  align-items: center;
  min-height: 38px;
  color: #72838c;
  font-size: 9.5px;
  border-bottom: 1px solid #dbe3e7;
  margin-bottom: 14px;
}
.dashboard-meta-strip span { display: flex; align-items: center; gap: 6px; }
.dashboard-meta-strip i { color: #31815a; }

.industrial-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 13px;
}
.industrial-kpi {
  min-height: 126px;
  padding: 15px 15px 13px;
  background: linear-gradient(180deg, #fff, #fbfcfd);
  border: 1px solid #d6e0e5;
  border-top: 3px solid #536c79;
  border-radius: 6px;
  box-shadow: 0 3px 9px rgba(14, 38, 50, .045);
  position: relative;
  overflow: hidden;
}
.industrial-kpi::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  right: -28px;
  bottom: -31px;
  border: 1px solid rgba(72,99,113,.11);
  transform: rotate(45deg);
}
.industrial-kpi.kpi-primary { border-top-color: #1d526e; }
.industrial-kpi.kpi-success { border-top-color: #168649; }
.industrial-kpi.kpi-warning { border-top-color: #cf810f; }
.industrial-kpi.kpi-danger { border-top-color: #c82f3f; }
.industrial-kpi.kpi-info { border-top-color: #256cb0; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi-top span { color: #61737d; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .62px; }
.kpi-top i { color: #7f919a; font-size: 14px; }
.kpi-value {
  margin-top: 12px;
  color: #132832;
  font: 600 25px/1 var(--kvpl-mono);
  letter-spacing: -1px;
  white-space: nowrap;
}
.kpi-value small { margin-left: 4px; color: #788a94; font-size: 9px; font-weight: 500; letter-spacing: .2px; }
.kpi-foot { margin-top: 10px; color: #82919a; font-size: 9px; }
.kpi-foot strong { color: #435964; font-weight: 600; }
.kpi-meter { height: 3px; margin-top: 9px; overflow: hidden; background: #e5ebee; }
.kpi-meter span { display: block; height: 100%; background: #168649; }

.industrial-panel {
  background: var(--industrial-panel);
  border: 1px solid #d5dfe4;
  border-radius: 7px;
  box-shadow: 0 3px 11px rgba(14, 38, 50, .045);
  overflow: hidden;
}
.industrial-panel-head {
  min-height: 58px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #dce4e8;
  background: linear-gradient(180deg, #fbfcfd, #f7f9fa);
}
.industrial-panel-head.compact { min-height: 53px; }
.panel-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #6f818b;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.industrial-panel-head h2 { margin: 0; color: #18303b; font-size: 12.5px; font-weight: 700; }
.panel-legend-note { color: #7d8d95; font-size: 9px; }
.panel-count {
  min-width: 28px;
  height: 25px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #e7eef1;
  color: #334e5c;
  font: 600 10px var(--kvpl-mono);
}
.panel-count.danger { color: #b32636; background: #fbe7ea; }
.panel-count.warning { color: #9a5b00; background: #fdf0d8; }
.panel-link { color: #176f48; font-size: 9.5px; font-weight: 700; text-decoration: none; }
.panel-link:hover { color: #095e38; }
.industrial-panel-body { padding: 15px; }
.chart-body { min-height: 334px; position: relative; }
.chart-empty {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8b9aa2;
  gap: 8px;
  font-size: 10px;
}
.chart-empty i { font-size: 25px; opacity: .55; }

.attention-list { padding: 6px 0; }
.attention-item {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 13px;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 9px 13px;
  border-bottom: 1px solid #edf1f3;
  color: #233a45;
  text-decoration: none;
  transition: background .15s;
}
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: #f7faf8; }
.attention-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #e8eef1;
  color: #546c78;
}
.attention-danger .attention-icon { color: #bd2637; background: #fbe7e9; }
.attention-warning .attention-icon { color: #a66305; background: #fff0d8; }
.attention-info .attention-icon { color: #1769aa; background: #e4f0f9; }
.attention-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.attention-copy strong { font-size: 10.5px; }
.attention-copy small { color: #778892; font-size: 9px; line-height: 1.35; }
.attention-arrow { color: #9cabb2; font-size: 10px; }
.attention-clear {
  min-height: 280px;
  padding: 35px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #74868f;
  gap: 6px;
}
.attention-clear i { color: #188a4d; font-size: 30px; }
.attention-clear strong { color: #2f4b58; font-size: 11px; }
.attention-clear span { font-size: 9.5px; }

.factory-control-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}
.factory-control-card {
  min-height: 172px;
  padding: 14px 14px 13px;
  border-right: 1px solid #e0e7ea;
  position: relative;
}
.factory-control-card:last-child { border-right: 0; }
.factory-control-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #647987;
}
.factory-control-card.fc-DE::before { background: #16a34a; }
.factory-control-card.fc-PW::before { background: #2563eb; }
.factory-control-card.fc-CF::before { background: #7c3aed; }
.factory-control-card.fc-LV::before { background: #d97706; }
.factory-control-card.fc-DD::before { background: #dc2626; }
.factory-control-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.factory-control-head > div { min-width: 0; display: flex; align-items: center; gap: 7px; }
.factory-code {
  min-width: 27px;
  height: 23px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #243c48;
  border-radius: 3px;
  font: 600 9px var(--kvpl-mono);
}
.factory-control-head strong { color: #273e49; font-size: 9.5px; line-height: 1.25; }
.factory-load { color: #89979e; font-size: 8px; white-space: nowrap; }
.factory-control-metrics {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 4px;
  margin: 15px 0 11px;
}
.factory-control-metrics > div { padding: 7px 3px; background: #f4f7f8; text-align: center; }
.factory-control-metrics span { display: block; color: #7d8d95; font-size: 7.5px; text-transform: uppercase; letter-spacing: .4px; }
.factory-control-metrics strong { color: #243b46; font: 600 14px var(--kvpl-mono); }
.factory-quantity-line,
.factory-progress-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.factory-quantity-line { color: #75868f; font-size: 8px; }
.factory-quantity-line strong { color: #1e3742; font-size: 9.5px; }
.industrial-progress { height: 4px; margin: 7px 0 5px; background: #e4eaed; overflow: hidden; }
.industrial-progress span { display: block; height: 100%; background: linear-gradient(90deg, #087a43, #54b948); }
.factory-progress-foot { color: #829199; font-size: 8px; }
.factory-progress-foot strong { color: #315264; font: 600 8.5px var(--kvpl-mono); }

.status-chart-wrap { display: grid; grid-template-columns: 43% 57%; align-items: center; min-height: 275px; }
.status-legend { padding-left: 12px; }
.status-legend > div {
  display: grid;
  grid-template-columns: 8px minmax(0,1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #edf1f3;
  color: #60737d;
  font-size: 8.8px;
}
.status-legend > div:last-child { border-bottom: 0; }
.status-legend strong { color: #263e49; font: 600 9px var(--kvpl-mono); }
.status-dot { width: 7px; height: 7px; border-radius: 1px; background: #64748b; }
.status-dot-draft { background:#94a3b8; }
.status-dot-pending_approval { background:#f59e0b; }
.status-dot-approved { background:#0ea5e9; }
.status-dot-active { background:#16a34a; }
.status-dot-partially_delivered { background:#2563eb; }
.status-dot-completed { background:#0f766e; }
.status-dot-on_hold { background:#d97706; }
.status-dot-cancelled { background:#dc2626; }
.status-dot-closed { background:#475569; }
.status-dot-rejected { background:#be123c; }

.concentration-list { padding: 5px 14px 10px; }
.concentration-item { padding: 10px 0 9px; border-bottom: 1px solid #edf1f3; }
.concentration-item:last-child { border-bottom: 0; }
.concentration-head,
.concentration-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.concentration-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2b424d; font-size: 9.5px; }
.concentration-head span { color: #55707d; font: 600 8.5px var(--kvpl-mono); }
.concentration-meta { margin-top: 3px; color: #839198; font-size: 8px; }
.concentration-meta strong { color: #536873; font-size: 8.5px; }
.micro-progress { height: 3px; margin-top: 6px; background: #e7ecef; overflow: hidden; }
.micro-progress span { display: block; height: 100%; background: #1f6f95; }
.micro-progress.grade span { background: #167b49; }

.industrial-table-wrap { max-height: 345px; }
.industrial-table th {
  padding: 9px 11px;
  background: #f4f7f8;
  color: #687a84;
  font-size: 8px;
  letter-spacing: .7px;
  border-bottom-color: #dbe4e8;
}
.industrial-table td { padding: 9px 11px; color: #314953; font-size: 9.5px; border-bottom-color: #edf1f3; }
.industrial-table tbody tr:hover { background: #f7faf8; }
.contract-link { color: #0b6d40; font: 600 9.5px var(--kvpl-mono); text-decoration: none; }
.contract-link:hover { color: #084d30; text-decoration: underline; }
.industrial-table .factory-chip { font-size: 8px; padding: 2px 6px; }

.aging-list { padding: 9px 15px 3px; }
.aging-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid #edf1f3; }
.aging-row:last-child { border-bottom: 0; }
.aging-label { display: flex; flex-direction: column; }
.aging-label strong { color: #344d59; font-size: 9px; }
.aging-label span { color: #85949b; font-size: 7.5px; }
.aging-value { color: #4b626e; font-size: 8.5px; }
.aging-bar { grid-column: 1 / -1; height: 4px; background: #e9edef; overflow: hidden; }
.aging-bar span { display: block; height: 100%; background: linear-gradient(90deg, #d99929, #c82f3f); }
.performance-callout {
  margin: 8px 15px 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #dbe4e8;
  background: #f5f8f9;
}
.performance-callout > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.performance-callout > div + div { border-left: 1px solid #dbe4e8; }
.performance-callout span { color: #758791; font-size: 7.5px; text-transform: uppercase; letter-spacing: .4px; }
.performance-callout strong { color: #233e4a; font: 600 15px var(--kvpl-mono); }

.mobile-live { color: #73858e; font-size: 8px; text-transform: uppercase; letter-spacing: .6px; }
.mobile-live span { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #29a75b; }

@media (max-width: 1399.98px) {
  .industrial-kpi-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .factory-control-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .factory-control-card { border-bottom: 1px solid #e0e7ea; }
}
@media (max-width: 1199.98px) {
  .factory-control-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .status-chart-wrap { grid-template-columns: 38% 62%; }
}
@media (max-width: 991.98px) {
  .kvpl-industrial-shell .content-wrapper { padding: 68px 12px 28px; }
  .management-head { align-items: flex-start; flex-direction: column; }
  .management-head-actions { width: 100%; justify-content: flex-start; }
  .factory-scope-form { flex: 1; min-width: 200px; }
  .dashboard-meta-strip { overflow-x: auto; white-space: nowrap; }
  .industrial-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .factory-control-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 575.98px) {
  .management-head h1 { font-size: 21px; }
  .management-head-actions .btn { flex: 1; }
  .factory-scope-form { min-width: 100%; }
  .industrial-kpi-grid { grid-template-columns: 1fr; }
  .industrial-kpi { min-height: 111px; }
  .factory-control-grid { grid-template-columns: 1fr; }
  .factory-control-card { border-right: 0; }
  .status-chart-wrap { grid-template-columns: 1fr; }
  .status-chart-wrap canvas { max-height: 165px; }
  .status-legend { padding: 5px 0 0; }
  .dashboard-meta-strip { gap: 14px; }
}

/* ═══ PHASE 3 V1 — CONTRACT CONTROL REGISTER ═══════════════════ */
.contract-filter-panel {
  margin-bottom: 14px;
  padding: 14px 16px 16px;
  border: 1px solid #dce4e8;
  border-top: 3px solid var(--kvpl-green);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,25,35,.045);
}
.contract-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
  padding-bottom: 11px;
  border-bottom: 1px solid #e7ecef;
}
.contract-filter-title { color: #203944; font-size: 13px; font-weight: 700; }
.contract-filter-subtitle { margin-top: 2px; color: #7a8b94; font-size: 10px; }
.contract-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px,2fr) repeat(4,minmax(130px,1fr));
  gap: 11px 12px;
  align-items: end;
}
.contract-filter-grid .form-group { margin: 0; }
.contract-filter-grid label {
  display: block;
  margin-bottom: 5px;
  color: #61737d;
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .55px;
}
.contract-filter-grid input,
.contract-filter-grid select {
  width: 100%;
  min-height: 35px;
  border: 1px solid #ced9de;
  border-radius: 5px;
  background: #fbfcfc;
  color: #263e49;
  font-size: 11px;
}
.contract-filter-grid input:focus,
.contract-filter-grid select:focus {
  border-color: #5a9d78;
  box-shadow: 0 0 0 3px rgba(20,108,60,.09);
  outline: none;
}
.filter-search-wide { grid-column: span 2; }
.filter-input-icon { position: relative; }
.filter-input-icon i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #7f919a;
  font-size: 11px;
}
.filter-input-icon input { padding-left: 31px; }
.contract-result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 8px;
  color: #5e717b;
  font-size: 10px;
}
.contract-result-summary strong { color: #243e49; font-family: var(--kvpl-mono); }
.contract-register-card { overflow: visible; }
.contract-register-table { font-size: 10px; }
.contract-register-table th { white-space: nowrap; }
.contract-register-table td { vertical-align: middle; }
.contract-number-cell { font: 600 9.5px var(--kvpl-mono); }
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}
.sort-link:hover,
.sort-link.active { color: #0b6d40; }
.quantity-over { color: #7c3aed; }
.due-overdue { color: #c92738; font-weight: 700; }
.contract-action-button { padding-inline: 7px; }
.contract-register-table .dropdown-menu { min-width: 170px; font-size: 11px; }
.contract-register-table .dropdown-item { padding: 7px 12px; }
.empty-state-icon { color: #91a0a8; font-size: 25px; }
.contract-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.pagination-pages { display: flex; gap: 5px; align-items: center; }
.pagination-control,
.pagination-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 31px;
  border: 1px solid #d2dce1;
  border-radius: 5px;
  background: #fff;
  color: #4f6570;
  font-size: 10px;
  text-decoration: none;
}
.pagination-control { width: max-content; padding: 0 10px; }
.pagination-control:last-child { justify-self: end; }
.pagination-page { min-width: 31px; padding: 0 7px; font-family: var(--kvpl-mono); }
.pagination-page:hover,
.pagination-control:hover { border-color: #6b9c83; color: #0b6d40; }
.pagination-page.active { border-color: var(--kvpl-green); background: var(--kvpl-green); color: #fff; }
.pagination-control.disabled { pointer-events: none; opacity: .45; }
.pagination-ellipsis { padding: 0 3px; color: #8a9aa2; }
.contract-workflow-tabs .tab-btn { text-decoration: none; }

/* Contract section navigator */
.contract-section-tabs {
  position: sticky;
  top: 58px;
  z-index: 20;
  display: flex;
  gap: 2px;
  margin: -2px 0 15px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid #dce4e8;
  border-radius: 7px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 4px 12px rgba(15,25,35,.055);
  backdrop-filter: blur(8px);
  scrollbar-width: thin;
}
.contract-section-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 4px;
  color: #617680;
  font-size: 9px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.contract-section-tabs a:hover { background: #f0f5f2; color: #0f6d40; }
.contract-section-tabs a.active { background: #dcefe4; color: #075f36; }
.contract-section-tabs i { font-size: 10px; }
.contract-section-anchor,
#documents { scroll-margin-top: 118px; }
.activity-action-pill {
  display: inline-flex;
  padding: 3px 7px;
  border: 1px solid #d7e2e6;
  border-radius: 999px;
  background: #f5f8f9;
  color: #39535f;
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}
.activity-history-table td { font-size: 9.5px; }

@media (max-width: 1399.98px) {
  .contract-filter-grid { grid-template-columns: minmax(220px,2fr) repeat(3,minmax(130px,1fr)); }
}
@media (max-width: 1199.98px) {
  .contract-filter-grid { grid-template-columns: repeat(3,minmax(150px,1fr)); }
  .filter-search-wide { grid-column: span 2; }
}
@media (max-width: 991.98px) {
  .contract-section-tabs { top: 55px; }
  .contract-filter-grid { grid-template-columns: repeat(2,minmax(140px,1fr)); }
  .filter-search-wide { grid-column: span 2; }
}
@media (max-width: 575.98px) {
  .contract-filter-header { align-items: flex-start; flex-direction: column; }
  .contract-filter-header > .d-flex { width: 100%; }
  .contract-filter-header .btn { flex: 1; }
  .contract-filter-grid { grid-template-columns: 1fr; }
  .filter-search-wide { grid-column: span 1; }
  .contract-result-summary { align-items: flex-start; flex-direction: column; }
  .contract-pagination { grid-template-columns: auto 1fr auto; }
  .pagination-pages { justify-content: center; }
  .pagination-control span { display: none; }
  .contract-section-tabs a span { display: none; }
  .contract-section-tabs a { padding: 8px 10px; }
}

/* ═══ PHASE 3 V2 – DASHBOARD DRILL-DOWNS & NOTIFICATIONS ═══════ */
.dashboard-click-grid .industrial-kpi,
a.industrial-kpi { color: inherit; text-decoration: none; cursor: pointer; }
a.industrial-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.10); border-color: #cbd5e1; }
.dashboard-card-link { color: inherit; text-decoration: none; }
.dashboard-card-link:hover { color: inherit; }

.currency-value-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px; padding: 16px 18px 18px;
}
.currency-value-card {
  display: block; color: inherit; text-decoration: none; border: 1px solid #dce5eb;
  border-radius: 12px; padding: 15px 16px; background: linear-gradient(135deg,#fff,#f8fbfc);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.currency-value-card:hover { color: inherit; transform: translateY(-2px); border-color: #9db3bf; box-shadow: 0 8px 22px rgba(15,23,42,.08); }
.currency-value-head { display:flex; align-items:center; justify-content:space-between; padding-bottom:11px; margin-bottom:11px; border-bottom:1px solid #e7edf2; }
.currency-value-head strong { font:700 17px var(--kvpl-mono); color:#0f5132; }
.currency-value-head span { font-size:11px; color:#64748b; text-transform:uppercase; letter-spacing:.55px; }
.currency-value-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.currency-value-metrics div { min-width:0; }
.currency-value-metrics span { display:block; font-size:10.5px; color:#64748b; margin-bottom:4px; }
.currency-value-metrics strong { display:block; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.value-data-note { margin:0 18px 16px; padding:9px 12px; border-radius:8px; background:#fff7ed; color:#9a3412; font-size:12px; }

.due-bucket-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.due-bucket-card {
  display:grid; grid-template-columns:1fr auto; align-items:center; gap:5px 12px;
  color:inherit; text-decoration:none; padding:15px 17px; border:1px solid #dce5eb;
  border-radius:12px; background:#fff; transition:transform .15s,box-shadow .15s;
}
.due-bucket-card:hover { color:inherit; transform:translateY(-2px); box-shadow:0 8px 20px rgba(15,23,42,.08); }
.due-bucket-card > div:first-child span { display:block; color:#64748b; font-size:11px; text-transform:uppercase; letter-spacing:.55px; }
.due-bucket-card > div:first-child strong { display:block; color:#1e293b; font-size:15px; }
.due-bucket-count { grid-row:1 / span 2; grid-column:2; min-width:45px; text-align:center; font:700 28px var(--kvpl-mono); }
.due-bucket-qty { grid-column:1; font-size:12px; color:#64748b; }
.due-bucket-7 { border-left:4px solid #dc2626; }
.due-bucket-15 { border-left:4px solid #d97706; }
.due-bucket-30 { border-left:4px solid #2563eb; }

.factory-control-card.dashboard-card-link { display:block; }
.status-legend a { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:8px; color:inherit; text-decoration:none; padding:5px 0; }
.status-legend a:hover span:nth-child(2) { color:#0f5132; text-decoration:underline; }
.concentration-item.dashboard-card-link { display:block; }
.aging-row.dashboard-card-link { display:grid; }
.performance-callout a { color:inherit; text-decoration:none; display:flex; align-items:center; justify-content:space-between; }
.performance-callout a:hover span { text-decoration:underline; }
.panel-count[href] { text-decoration:none; }

.sidebar-notification-badge {
  margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center; background:#dc2626;
  color:#fff; font:700 10px var(--kvpl-mono);
}
.notification-dropdown-shell { position:relative; }
.notification-button { border:0; position:relative; }
.notification-count {
  position:absolute; top:-5px; right:-6px; min-width:18px; height:18px; padding:0 4px;
  display:flex; align-items:center; justify-content:center; border:2px solid #fff;
  border-radius:999px; background:#dc2626; color:#fff; font:700 9px var(--kvpl-mono);
}
.notification-dropdown { width:390px; padding:0; border:1px solid #dbe5eb; border-radius:12px; overflow:hidden; }
.notification-dropdown-head { display:flex; align-items:center; justify-content:space-between; padding:14px 15px; background:#f8fafc; border-bottom:1px solid #e2e8f0; }
.notification-dropdown-head strong { display:block; font-size:13px; }
.notification-dropdown-head span { display:block; font-size:10.5px; color:#64748b; }
.notification-dropdown-head a { font-size:11px; font-weight:700; color:#0f6b3c; text-decoration:none; }
.notification-dropdown-list { max-height:390px; overflow-y:auto; }
.notification-preview { display:grid; grid-template-columns:34px 1fr; gap:10px; padding:11px 14px; color:inherit; text-decoration:none; border-bottom:1px solid #edf2f5; }
.notification-preview:last-child { border-bottom:0; }
.notification-preview:hover { color:inherit; background:#f8fafc; }
.notification-preview > span { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; background:#eef2f7; color:#475569; }
.notification-preview strong { display:block; font-size:11.5px; margin-bottom:2px; }
.notification-preview small { display:block; color:#64748b; font-size:10.5px; }
.notification-preview-danger > span { background:#fee2e2; color:#b91c1c; }
.notification-preview-warning > span { background:#fef3c7; color:#92400e; }
.notification-preview-info > span { background:#dbeafe; color:#1d4ed8; }
.notification-preview-empty { padding:28px; display:flex; gap:8px; align-items:center; justify-content:center; color:#64748b; font-size:12px; }
.mobile-notification-link { position:relative; color:#1e293b; padding:9px; font-size:18px; }
.mobile-notification-link span { position:absolute; top:1px; right:0; background:#dc2626; color:#fff; border-radius:999px; min-width:17px; height:17px; display:flex; align-items:center; justify-content:center; font:700 9px var(--kvpl-mono); }

.notification-centre-list { padding:6px 0; }
.notification-centre-item { display:grid; grid-template-columns:42px 1fr auto; align-items:center; gap:12px; color:inherit; text-decoration:none; padding:14px 17px; border-bottom:1px solid #edf2f5; }
.notification-centre-item:hover { color:inherit; background:#f8fafc; }
.notification-centre-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:#eef2f7; }
.notification-centre-item strong { display:block; font-size:13px; }
.notification-centre-item small { display:block; font-size:11.5px; color:#64748b; margin-top:2px; }
.notification-centre-danger .notification-centre-icon { background:#fee2e2; color:#b91c1c; }
.notification-centre-warning .notification-centre-icon { background:#fef3c7; color:#92400e; }
.notification-centre-info .notification-centre-icon { background:#dbeafe; color:#1d4ed8; }
.notification-due-list a { display:flex; justify-content:space-between; align-items:center; color:inherit; text-decoration:none; padding:16px 18px; border-bottom:1px solid #edf2f5; }
.notification-due-list a:hover { color:inherit; background:#f8fafc; }
.notification-due-list strong,.notification-due-list span { display:block; }
.notification-due-list strong { font-size:13px; }
.notification-due-list span { font-size:11px; color:#64748b; }
.dashboard-filter-context { display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin:-3px 0 12px; padding:8px 11px; border-radius:8px; background:#eff6ff; color:#1e3a8a; font-size:11.5px; }
.dashboard-filter-context strong { padding:3px 8px; border-radius:999px; background:#dbeafe; }

@media (max-width: 991px) {
  .currency-value-metrics { grid-template-columns:1fr; }
  .due-bucket-grid { grid-template-columns:1fr; }
}
@media (max-width: 575px) {
  .currency-value-grid { grid-template-columns:1fr; padding:12px; }
  .notification-dropdown { width:min(390px, calc(100vw - 24px)); }
}

/* Phase 3 V3 - Industrial Reporting Suite */
.report-suite-hero { display:grid; grid-template-columns:1fr auto; gap:24px; align-items:center; padding:26px 28px; border-radius:16px; background:linear-gradient(135deg,#102a23,#174a37); color:#fff; box-shadow:0 12px 30px rgba(15,42,35,.18); }
.report-suite-kicker { display:inline-block; margin-bottom:7px; color:#86efac; font:700 10px var(--kvpl-mono); letter-spacing:1px; text-transform:uppercase; }
.report-suite-hero h2 { margin:0 0 7px; font-size:23px; }
.report-suite-hero p { margin:0; color:#cbd5e1; max-width:760px; font-size:13px; }
.report-suite-hero-stat { min-width:125px; text-align:center; padding:15px 18px; border:1px solid rgba(255,255,255,.18); border-radius:12px; background:rgba(255,255,255,.07); }
.report-suite-hero-stat strong { display:block; font:700 34px var(--kvpl-mono); }
.report-suite-hero-stat span { display:block; font-size:10px; color:#cbd5e1; text-transform:uppercase; letter-spacing:.7px; }
.report-catalogue-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.report-catalogue-card { position:relative; display:grid; grid-template-columns:46px 1fr auto; gap:14px; align-items:start; min-height:210px; padding:20px; color:inherit; text-decoration:none; background:#fff; border:1px solid #dbe5eb; border-top:4px solid #146c3c; border-radius:14px; box-shadow:0 5px 18px rgba(15,23,42,.05); transition:transform .16s,box-shadow .16s,border-color .16s; }
.report-catalogue-card:hover { color:inherit; transform:translateY(-3px); box-shadow:0 13px 30px rgba(15,23,42,.10); }
.report-accent-amber { border-top-color:#d97706; }.report-accent-red { border-top-color:#dc2626; }
.report-catalogue-icon { width:44px; height:44px; display:flex; align-items:center; justify-content:center; border-radius:11px; background:#e3f5ea; color:#146c3c; font-size:20px; }
.report-accent-amber .report-catalogue-icon { background:#fef3c7;color:#a16207; }.report-accent-red .report-catalogue-icon { background:#fee2e2;color:#b91c1c; }
.report-catalogue-label { display:block; margin-bottom:4px; font-size:9.5px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:.65px; }
.report-catalogue-copy h3 { font-size:17px; margin:0 0 7px; }.report-catalogue-copy p { margin:0; font-size:12px; color:#64748b; line-height:1.55; }
.report-catalogue-metrics { display:flex; flex-wrap:wrap; gap:8px 14px; margin-top:18px; padding-top:13px; border-top:1px solid #e7edf1; font-size:10.5px; color:#64748b; }.report-catalogue-metrics strong { color:#1e293b; font-family:var(--kvpl-mono); }
.report-catalogue-arrow { align-self:center; color:#94a3b8; font-size:18px; }
.report-control-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:0; }.report-control-grid>div { padding:19px; border-right:1px solid #e7edf1; }.report-control-grid>div:last-child{border-right:0}.report-control-grid i{display:block;color:#146c3c;font-size:20px;margin-bottom:8px}.report-control-grid strong,.report-control-grid span{display:block}.report-control-grid strong{font-size:12px}.report-control-grid span{margin-top:4px;color:#64748b;font-size:10.5px;line-height:1.5}
.industrial-report-toolbar { margin-bottom:16px; }.industrial-report-filter-form { background:#fff; border:1px solid #dbe5eb; border-radius:13px; overflow:hidden; }
.industrial-filter-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 16px; background:#f8fafc; border-bottom:1px solid #e3eaf0; }.industrial-filter-heading>div:first-child{display:grid;grid-template-columns:auto auto;gap:0 7px;align-items:center}.industrial-filter-heading i{grid-row:1/span 2;color:#146c3c}.industrial-filter-heading strong{font-size:12px}.industrial-filter-heading span{grid-column:2;color:#64748b;font-size:10px}
.industrial-filter-grid { display:grid; grid-template-columns:repeat(5,minmax(130px,1fr)); gap:11px; padding:15px 16px; }.industrial-filter-grid label{min-width:0}.industrial-filter-grid label>span{display:block;margin-bottom:4px;color:#526273;font-size:9.5px;font-weight:700;text-transform:uppercase;letter-spacing:.4px}.industrial-filter-grid input,.industrial-filter-grid select{width:100%;height:35px;padding:6px 8px;border:1px solid #cfd9e0;border-radius:7px;background:#fff;font-size:11px}.industrial-filter-search{grid-column:span 2}
.industrial-filter-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:11px 16px; border-top:1px solid #e7edf1; }.industrial-active-filters{display:flex;flex-wrap:wrap;gap:5px;margin-left:auto}.industrial-active-filters span{padding:4px 8px;border-radius:999px;background:#e0f2fe;color:#075985;font-size:9.5px}
.industrial-report-kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:16px; }.industrial-report-kpi{padding:16px 18px;border:1px solid #dbe5eb;border-radius:12px;background:#fff}.industrial-report-kpi span,.industrial-report-kpi small{display:block;color:#64748b}.industrial-report-kpi span{font-size:10px;text-transform:uppercase;letter-spacing:.5px}.industrial-report-kpi strong{display:block;margin:5px 0 2px;font:700 23px var(--kvpl-mono);color:#1e293b}.industrial-report-kpi small{font-size:10px}.industrial-report-kpi-emphasis{border-left:4px solid #dc2626}
.industrial-currency-summary { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:10px; padding:15px; }.industrial-currency-summary>div{padding:12px 14px;border:1px solid #e0e7eb;border-radius:10px;background:#f8fafc}.industrial-currency-summary>div>strong{display:block;margin-bottom:8px;font:700 15px var(--kvpl-mono);color:#146c3c}.industrial-currency-summary span{display:flex;justify-content:space-between;gap:8px;font-size:10px;color:#64748b;margin-top:4px}.industrial-currency-summary b{color:#1e293b;font-family:var(--kvpl-mono)}
.industrial-age-summary{display:grid;grid-template-columns:repeat(5,1fr);height:calc(100% - 45px)}.industrial-age-summary>div{display:flex;flex-direction:column;justify-content:center;text-align:center;padding:12px 7px;border-right:1px solid #e7edf1}.industrial-age-summary>div:last-child{border-right:0}.industrial-age-summary span,.industrial-age-summary small{color:#64748b;font-size:9px}.industrial-age-summary strong{font:700 20px var(--kvpl-mono);margin:4px 0}
.industrial-report-table-card{overflow:hidden}.industrial-report-table{font-size:10.5px}.industrial-report-table th{white-space:nowrap;background:#f1f5f9;color:#475569;font-size:9px;text-transform:uppercase;letter-spacing:.35px}.industrial-report-table td{vertical-align:top}.industrial-report-table td strong,.industrial-report-table td small{display:block}.industrial-report-table td small{margin-top:2px;color:#64748b;font-size:9.5px}.report-contract-link{font:700 11px var(--kvpl-mono);color:#146c3c;text-decoration:none}.report-contract-link:hover{text-decoration:underline}.industrial-report-pagination{display:flex;align-items:center;justify-content:space-between;padding:12px 15px;border-top:1px solid #e7edf1}.industrial-report-pagination>div{display:flex;gap:4px}.industrial-report-pagination>div a{width:30px;height:30px;display:flex;align-items:center;justify-content:center;border:1px solid #d5dee4;border-radius:6px;color:#475569;text-decoration:none;font:600 10px var(--kvpl-mono)}.industrial-report-pagination>div a.active{background:#146c3c;color:#fff;border-color:#146c3c}
.saved-report-view{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;padding:11px 0;border-bottom:1px solid #e7edf1}.saved-report-view>a{color:inherit;text-decoration:none;padding:7px;border-radius:7px}.saved-report-view>a:hover{background:#f8fafc}.saved-report-view strong,.saved-report-view small{display:block}.saved-report-view strong{font-size:12px}.saved-report-view small{font-size:9.5px;color:#64748b;margin-top:3px}
@media(max-width:1200px){.report-catalogue-grid{grid-template-columns:1fr 1fr}.industrial-filter-grid{grid-template-columns:repeat(3,1fr)}.report-control-grid{grid-template-columns:1fr 1fr}.report-control-grid>div:nth-child(2){border-right:0}.report-control-grid>div{border-bottom:1px solid #e7edf1}}
@media(max-width:767px){.report-suite-hero{grid-template-columns:1fr;padding:21px}.report-suite-hero-stat{display:none}.report-catalogue-grid{grid-template-columns:1fr}.industrial-filter-heading{align-items:flex-start;flex-direction:column}.industrial-filter-grid{grid-template-columns:1fr 1fr}.industrial-filter-search{grid-column:span 2}.industrial-report-kpi-grid{grid-template-columns:1fr 1fr}.industrial-age-summary{grid-template-columns:1fr;}.industrial-age-summary>div{border-right:0;border-bottom:1px solid #e7edf1}.industrial-active-filters{width:100%;margin-left:0}.report-control-grid{grid-template-columns:1fr}.report-control-grid>div{border-right:0}.industrial-report-table{min-width:1180px}}
@media(max-width:480px){.industrial-filter-grid{grid-template-columns:1fr}.industrial-filter-search{grid-column:1}.industrial-report-kpi-grid{grid-template-columns:1fr}}

/* Phase 3 V3.1 - Reporting expansion */
.report-accent-blue{border-top-color:#2563eb}.report-accent-purple{border-top-color:#7c3aed}.report-accent-teal{border-top-color:#0f766e}.report-accent-indigo{border-top-color:#4f46e5}.report-accent-cyan{border-top-color:#0891b2}
.report-accent-blue .report-catalogue-icon{background:#dbeafe;color:#1d4ed8}.report-accent-purple .report-catalogue-icon{background:#ede9fe;color:#6d28d9}.report-accent-teal .report-catalogue-icon{background:#ccfbf1;color:#0f766e}.report-accent-indigo .report-catalogue-icon{background:#e0e7ff;color:#4338ca}.report-accent-cyan .report-catalogue-icon{background:#cffafe;color:#0e7490}
.industrial-aggregate-table{min-width:1050px}.industrial-aggregate-table td{vertical-align:middle}.report-group-link{font-weight:700;color:#146c3c;text-decoration:none}.report-group-link:hover{text-decoration:underline}.industrial-aggregate-table .number{font-family:var(--kvpl-mono);white-space:nowrap}

/* Phase 3 V3 reporting completion accents */
.report-accent-emerald{border-top-color:#059669}.report-accent-orange{border-top-color:#ea580c}.report-accent-violet{border-top-color:#7c3aed}.report-accent-slate{border-top-color:#475569}
.report-accent-emerald .report-catalogue-icon{background:#d1fae5;color:#047857}.report-accent-orange .report-catalogue-icon{background:#ffedd5;color:#c2410c}.report-accent-violet .report-catalogue-icon{background:#ede9fe;color:#6d28d9}.report-accent-slate .report-catalogue-icon{background:#e2e8f0;color:#334155}

/* Phase 3 V4 – alerts and automation */
.alert-summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.alert-summary-card{display:flex;flex-direction:column;padding:18px;border:1px solid #dbe4e8;border-radius:12px;background:#fff;color:#334155;text-decoration:none}.alert-summary-card.active{border-color:#16734a;box-shadow:0 0 0 2px rgba(22,115,74,.12)}.alert-summary-card span{font-size:12px;text-transform:uppercase;letter-spacing:.06em}.alert-summary-card strong{font-size:30px;color:#0f2d25}.alert-summary-card small{color:#64748b}.persistent-alert-list{display:flex;flex-direction:column}.persistent-alert{display:grid;grid-template-columns:48px 1fr auto;gap:14px;padding:18px;border-bottom:1px solid #e5ecef;align-items:start}.persistent-alert:last-child{border-bottom:0}.persistent-alert.acknowledged{opacity:.7;background:#f8fafc}.persistent-alert-icon{width:42px;height:42px;border-radius:10px;display:grid;place-items:center;background:#edf4f1;color:#155e45;font-size:18px}.persistent-alert-critical .persistent-alert-icon,.persistent-alert-danger .persistent-alert-icon{background:#fee2e2;color:#b91c1c}.persistent-alert-warning .persistent-alert-icon{background:#fef3c7;color:#92400e}.persistent-alert-info .persistent-alert-icon{background:#dbeafe;color:#1d4ed8}.persistent-alert-meta{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:5px}.persistent-alert-meta span{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:#64748b;background:#f1f5f9;padding:3px 6px;border-radius:5px}.persistent-alert-content a{text-decoration:none;color:#102a23}.persistent-alert-content p{margin:4px 0;color:#475569}.persistent-alert-content small{color:#94a3b8}.persistent-alert-actions{display:flex;gap:6px;align-items:center}.acknowledgement-note{margin-top:8px;padding:7px 9px;border-radius:7px;background:#ecfdf5;color:#166534;font-size:12px}.automation-toggle-grid{display:grid;gap:12px}.automation-toggle-grid.two-column{grid-template-columns:repeat(2,minmax(0,1fr))}.automation-toggle-grid label,.factory-scope-grid label{display:flex;gap:10px;align-items:flex-start;padding:12px;border:1px solid #e2e8f0;border-radius:10px;cursor:pointer}.automation-toggle-grid input,.factory-scope-grid input,.automation-inline-toggle input{width:auto;margin-top:3px}.automation-toggle-grid span{display:flex;flex-direction:column}.automation-toggle-grid small{color:#64748b;margin-top:2px}.automation-inline-toggle{display:flex;gap:8px;align-items:center;font-weight:600}.factory-scope-grid{display:grid;gap:8px}.automation-kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.automation-kpi-grid>div{background:#102a23;color:#fff;padding:18px;border-radius:12px}.automation-kpi-grid span{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:#b8d1c8}.automation-kpi-grid strong{font-size:28px}.automation-alert-types>div{display:grid;grid-template-columns:1fr auto auto;gap:10px;padding:12px 16px;border-bottom:1px solid #e5ecef}.automation-alert-types small{color:#64748b}
@media(max-width:900px){.automation-toggle-grid.two-column,.automation-kpi-grid{grid-template-columns:1fr 1fr}.persistent-alert{grid-template-columns:40px 1fr}.persistent-alert-actions{grid-column:2;flex-wrap:wrap}}@media(max-width:600px){.alert-summary-grid,.automation-toggle-grid.two-column,.automation-kpi-grid{grid-template-columns:1fr}.persistent-alert{padding:14px}.persistent-alert-actions{grid-column:1/-1}}
.document-expiry-form{display:flex;align-items:center;gap:5px}.document-expiry-form input{min-width:135px;padding:6px 8px;font-size:12px}

/* ═══════════════════════════════════════════════════════════════
   Phase 3.7 – Modern Workspace UI
   Inspired by contemporary productivity dashboards while retaining
   KVPL's green identity and all operational workflows.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --kvpl-sidebar-w: 252px;
  --modern-ink: #171726;
  --modern-muted: #77758a;
  --modern-line: #e9e7f1;
  --modern-line-strong: #dcd9e8;
  --modern-surface: rgba(255,255,255,.94);
  --modern-surface-solid: #ffffff;
  --modern-bg: #f5f4fb;
  --modern-purple: #7b6de8;
  --modern-purple-deep: #6555d8;
  --modern-purple-soft: #eeeafd;
  --modern-teal: #2bc7b5;
  --modern-teal-deep: #0c8e7d;
  --modern-teal-soft: #e5faf7;
  --modern-blue: #5d87e8;
  --modern-blue-soft: #eaf0ff;
  --modern-amber: #eca857;
  --modern-amber-soft: #fff4e4;
  --modern-red: #e56b7a;
  --modern-red-soft: #ffedf0;
  --modern-shadow: 0 12px 35px rgba(66, 52, 112, .075);
  --modern-shadow-hover: 0 18px 44px rgba(66, 52, 112, .13);
}

html { background: var(--modern-bg); }
body.kvpl-modern-shell {
  min-height: 100vh;
  color: var(--modern-ink);
  background-color: var(--modern-bg);
  background-image:
    linear-gradient(rgba(123,109,232,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123,109,232,.045) 1px, transparent 1px),
    radial-gradient(circle at 86% 2%, rgba(172,161,255,.24), transparent 28%),
    radial-gradient(circle at 18% 92%, rgba(43,199,181,.12), transparent 30%);
  background-size: 32px 32px, 32px 32px, auto, auto;
  background-attachment: fixed;
  font-family: var(--kvpl-font);
}

/* Modern light sidebar */
.kvpl-modern-shell .kvpl-sidebar {
  width: var(--kvpl-sidebar-w);
  padding: 14px 12px 12px;
  background: rgba(255,255,255,.96);
  border-right: 1px solid rgba(219,216,232,.9);
  box-shadow: 12px 0 35px rgba(74,61,111,.045);
  backdrop-filter: blur(18px);
}
.kvpl-modern-shell .sidebar-brand {
  min-height: 66px;
  padding: 9px 10px 13px;
  gap: 11px;
  border: 0;
  border-bottom: 1px solid #f0eef5;
  color: var(--modern-ink);
}
.kvpl-modern-shell .brand-logo-shell {
  width: 42px;
  height: 42px;
  padding: 6px;
  border: 1px solid #e4e2ec;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: 0 5px 14px rgba(45,39,74,.07);
  flex-shrink: 0;
}
.kvpl-modern-shell .brand-logo-shell img { width: 100%; max-height: 100%; object-fit: contain; }
.kvpl-modern-shell .brand-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kvpl-modern-shell .brand-name { color: var(--modern-ink); font-size: 15px; font-weight: 800; }
.kvpl-modern-shell .brand-sub { color: #89869a; font-size: 10px; white-space: nowrap; }
.kvpl-modern-shell .brand-chevron { color: #a09dae; font-size: 12px; }

.sidebar-user-switcher {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 13px 2px 8px;
  padding: 9px 10px;
  border: 1px solid #ebe9f2;
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 5px 16px rgba(45,39,74,.045);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.sidebar-user-switcher:hover {
  color: inherit;
  transform: translateY(-1px);
  border-color: #d9d3f5;
  box-shadow: 0 9px 22px rgba(66,52,112,.09);
}
.kvpl-modern-shell .user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--modern-purple), var(--modern-teal));
  box-shadow: 0 5px 14px rgba(103,88,211,.22);
}
.sidebar-user-switcher .user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-switcher .user-name { color: #262436; font-size: 11.5px; font-weight: 700; }
.sidebar-user-switcher .user-role {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #8f8b9c;
  font-size: 9.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: #39c28f; box-shadow: 0 0 0 2px #e7f9f2; flex-shrink: 0; }
.sidebar-user-switcher > i { color: #a29fad; font-size: 12px; }

.kvpl-modern-shell .sidebar-nav { padding: 9px 3px 14px; }
.kvpl-modern-shell .nav-section-label {
  padding: 9px 10px 5px;
  color: #aaa6b6;
  font-size: 8.5px;
  letter-spacing: 1.15px;
}
.kvpl-modern-shell .sidebar-nav .nav-link {
  min-height: 38px;
  padding: 9px 10px;
  gap: 11px;
  border-radius: 10px;
  color: #575468;
  font-size: 11.5px;
  font-weight: 600;
}
.kvpl-modern-shell .sidebar-nav .nav-link i {
  width: 19px;
  color: #787487;
  font-size: 14px;
  opacity: 1;
}
.kvpl-modern-shell .sidebar-nav .nav-link:hover {
  color: #3b3653;
  background: #f6f4fc;
}
.kvpl-modern-shell .sidebar-nav .nav-link.active {
  color: #5548bf;
  background: linear-gradient(90deg, #eeeafd, #f5f3ff);
  box-shadow: inset 3px 0 0 #7b6de8;
}
.kvpl-modern-shell .sidebar-nav .nav-link.active i { color: var(--modern-purple); }
.kvpl-modern-shell .sidebar-notification-badge {
  height: 18px;
  min-width: 18px;
  background: linear-gradient(135deg, #e96f83, #cf4f67);
  border: 2px solid #fff;
  font-size: 8px;
}
.kvpl-modern-shell .sidebar-footer {
  padding: 10px 3px 4px;
  border-top: 1px solid #efedf4;
}
.sidebar-footer-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #6a6679;
  text-decoration: none;
  font: 600 10.5px var(--kvpl-font);
  text-align: left;
}
.sidebar-footer-link:hover { color: #443d69; background: #f5f3fb; }
.sidebar-footer-link i { width: 18px; text-align: center; font-size: 13px; }
.sidebar-logout-form { margin: 0; }
.sidebar-signout { color: #aa5360; }
.kvpl-modern-shell .sidebar-version {
  margin-top: 7px;
  color: #b4b0bd;
  font-size: 7.5px;
}

/* Main workspace and command bar */
.kvpl-modern-shell .kvpl-main { margin-left: var(--kvpl-sidebar-w); }
.kvpl-modern-shell .command-bar {
  height: 68px;
  padding: 0 28px;
  background: rgba(255,255,255,.78);
  border-bottom: 1px solid rgba(222,219,232,.8);
  box-shadow: 0 5px 20px rgba(76,61,116,.035);
  backdrop-filter: blur(18px);
}
.kvpl-modern-shell .command-context { gap: 10px; }
.workspace-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--modern-purple-soft), var(--modern-teal-soft));
  color: var(--modern-purple-deep);
}
.command-copy { display: flex; flex-direction: column; }
.kvpl-modern-shell .command-eyebrow { color: #9995a6; font-size: 8px; letter-spacing: .95px; }
.kvpl-modern-shell .command-module { color: #343145; font-size: 11.5px; font-weight: 700; }
.kvpl-modern-shell .global-search { width: min(430px, 34vw); }
.kvpl-modern-shell .global-search input {
  height: 40px;
  padding-left: 36px;
  border: 1px solid #e4e1ed;
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  color: #292638;
  font-size: 10.5px;
}
.kvpl-modern-shell .global-search input:focus {
  border-color: #bfb7f2;
  box-shadow: 0 0 0 4px rgba(123,109,232,.10);
}
.kvpl-modern-shell .global-search kbd {
  top: 9px;
  border-color: #e2dfeb;
  border-radius: 6px;
  color: #9b97a7;
}
.kvpl-modern-shell .command-icon {
  width: 40px;
  height: 40px;
  border: 1px solid #e4e1ed;
  border-radius: 12px;
  background: rgba(255,255,255,.9);
  color: #5d596b;
  box-shadow: 0 4px 12px rgba(66,52,112,.04);
}
.kvpl-modern-shell .command-icon:hover {
  color: var(--modern-purple-deep);
  border-color: #cfc8f6;
  background: #f7f5ff;
}
.kvpl-modern-shell .content-wrapper {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 25px 28px 55px;
}

/* Global cards, forms, buttons and tables – affects the full system */
.kvpl-modern-shell .page-header {
  margin-bottom: 20px;
  padding: 5px 0 16px;
  border-bottom: 0;
}
.kvpl-modern-shell .page-title { color: var(--modern-ink); font-size: 23px; font-weight: 800; }
.kvpl-modern-shell .page-title small { color: var(--modern-muted); font-size: 11px; }
.kvpl-modern-shell .card,
.kvpl-modern-shell .kvpl-card,
.kvpl-modern-shell .filter-panel,
.kvpl-modern-shell .form-section {
  border: 1px solid var(--modern-line) !important;
  border-radius: 17px !important;
  background: rgba(255,255,255,.94) !important;
  box-shadow: var(--modern-shadow) !important;
}
.kvpl-modern-shell .card-header,
.kvpl-modern-shell .kvpl-card-header {
  padding: 14px 18px;
  border-color: #efedf4 !important;
  background: rgba(250,249,253,.92) !important;
  border-radius: 17px 17px 0 0 !important;
}
.kvpl-modern-shell .btn {
  min-height: 36px;
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 10.5px;
  font-weight: 700;
}
.kvpl-modern-shell .btn-sm { min-height: 32px; padding: 5px 11px; font-size: 9.5px; }
.kvpl-modern-shell .btn-primary {
  background: linear-gradient(135deg, var(--modern-purple), var(--modern-purple-deep));
  border-color: var(--modern-purple);
  box-shadow: 0 7px 18px rgba(103,88,211,.22);
}
.kvpl-modern-shell .btn-primary:hover,
.kvpl-modern-shell .btn-primary:focus {
  background: linear-gradient(135deg, #7365e0, #5949c7);
  border-color: #6658d5;
}
.kvpl-modern-shell .btn-success {
  background: linear-gradient(135deg, #26bfa9, #138f7e);
  border-color: #20a996;
}
.kvpl-modern-shell .btn-outline-secondary {
  color: #5d596b;
  border-color: #dcd8e8;
  background: #fff;
}
.kvpl-modern-shell .btn-outline-secondary:hover { color: #4d4297; border-color: #cfc7f3; background: #f5f2ff; }
.kvpl-modern-shell .form-control,
.kvpl-modern-shell .form-select,
.kvpl-modern-shell .form-group input,
.kvpl-modern-shell .form-group select,
.kvpl-modern-shell .form-group textarea {
  min-height: 39px;
  border: 1px solid #dedbe8;
  border-radius: 10px;
  background-color: #fff;
  color: #302d40;
  font-size: 11px;
}
.kvpl-modern-shell .form-control:focus,
.kvpl-modern-shell .form-select:focus,
.kvpl-modern-shell .form-group input:focus,
.kvpl-modern-shell .form-group select:focus,
.kvpl-modern-shell .form-group textarea:focus {
  border-color: #bcb3f1;
  box-shadow: 0 0 0 4px rgba(123,109,232,.10);
}
.kvpl-modern-shell .form-label,
.kvpl-modern-shell .field-label,
.kvpl-modern-shell .form-group label { color: #5f5b6d; font-size: 9.5px; font-weight: 700; }
.kvpl-modern-shell .table,
.kvpl-modern-shell .kvpl-table,
.kvpl-modern-shell .industrial-table { --bs-table-bg: transparent; }
.kvpl-modern-shell .table thead th,
.kvpl-modern-shell .kvpl-table thead th,
.kvpl-modern-shell .industrial-table thead th {
  color: #8b8798;
  background: #faf9fc;
  border-color: #ece9f2;
  font-size: 8.5px;
  letter-spacing: .65px;
}
.kvpl-modern-shell .table tbody td,
.kvpl-modern-shell .kvpl-table tbody td,
.kvpl-modern-shell .industrial-table tbody td {
  color: #454153;
  border-color: #f0eef5;
  font-size: 10.5px;
}
.kvpl-modern-shell .table tbody tr:hover,
.kvpl-modern-shell .kvpl-table tbody tr:hover,
.kvpl-modern-shell .industrial-table tbody tr:hover { background: #faf9fd; }
.kvpl-modern-shell .alert { border: 0; border-radius: 13px; box-shadow: 0 8px 24px rgba(66,52,112,.08); }
.kvpl-modern-shell .dropdown-menu { border-color: #e8e4f0; border-radius: 14px; }
.kvpl-modern-shell .badge { border-radius: 999px; padding: 5px 8px; font-size: 8.5px; }
.kvpl-modern-shell .pagination .page-link { color: #6559b8; border-color: #e4e0ed; }

/* Dashboard hero */
.modern-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(300px,390px);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 14px;
}
.dashboard-greeting {
  min-height: 190px;
  padding: 25px 27px;
  border: 1px solid rgba(226,222,238,.95);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 12%, rgba(123,109,232,.19), transparent 31%),
    radial-gradient(circle at 73% 100%, rgba(43,199,181,.12), transparent 35%),
    rgba(255,255,255,.93);
  box-shadow: var(--modern-shadow);
  position: relative;
  overflow: hidden;
}
.dashboard-greeting::after {
  content: '';
  position: absolute;
  width: 170px;
  height: 170px;
  right: -65px;
  top: -70px;
  border: 1px solid rgba(123,109,232,.15);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(123,109,232,.035), 0 0 0 54px rgba(43,199,181,.025);
}
.dashboard-greeting .management-kicker {
  display: block;
  margin: 0 0 9px;
  color: #8e89a0;
  font-size: 8.5px;
  letter-spacing: 1.1px;
}
.dashboard-greeting h1 {
  margin: 0;
  color: #171522;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -1.3px;
}
.dashboard-greeting p {
  margin: 6px 0 20px;
  color: var(--modern-purple-deep);
  font-size: clamp(17px, 2vw, 25px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.75px;
}
.dashboard-greeting p span {
  background: linear-gradient(90deg, var(--modern-teal), var(--modern-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.dashboard-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.quick-action {
  min-height: 34px;
  padding: 7px 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dcd8e8;
  border-radius: 999px;
  background: rgba(255,255,255,.87);
  color: #454052;
  text-decoration: none;
  font-size: 9.5px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.quick-action:hover { color: #4d419f; transform: translateY(-1px); border-color: #c8c0ef; box-shadow: 0 7px 17px rgba(66,52,112,.08); }
.quick-action-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #8b79ed, #6656d6);
  box-shadow: 0 7px 18px rgba(103,88,211,.22);
}
.quick-action-primary:hover { color: #fff; border-color: transparent; }
.dashboard-scope-card {
  padding: 22px;
  display: grid;
  grid-template-columns: 46px minmax(0,1fr);
  gap: 12px 14px;
  align-content: center;
  border: 1px solid #e5e2ee;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(246,243,255,.96));
  box-shadow: var(--modern-shadow);
}
.scope-card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--modern-purple-soft), #e3fbf7);
  color: var(--modern-purple-deep);
  font-size: 18px;
}
.scope-card-copy { display: flex; flex-direction: column; min-width: 0; }
.scope-card-copy span { color: #8d8999; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.scope-card-copy strong { margin-top: 3px; color: #282437; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-card-copy small { margin-top: 2px; color: #9b97a6; font-size: 9px; }
.dashboard-scope-card .factory-scope-form { grid-column: 1 / -1; min-width: 0; margin-top: 5px; }
.dashboard-scope-card .factory-scope-form label { color: #918d9c; font-size: 8px; }
.dashboard-scope-card .factory-scope-form select {
  width: 100%;
  height: 39px;
  border: 1px solid #ded9eb;
  border-radius: 11px;
  color: #484357;
  background: #fff;
  font-size: 10.5px;
}
.kvpl-modern-shell .dashboard-meta-strip {
  min-height: 39px;
  margin: 0 0 14px;
  padding: 0 5px;
  gap: 18px;
  color: #8a8695;
  border-bottom: 0;
  font-size: 8.5px;
}
.kvpl-modern-shell .dashboard-meta-strip i { color: var(--modern-teal-deep); }

/* Dashboard cards and panels */
.kvpl-modern-shell .industrial-kpi-grid {
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kvpl-modern-shell .industrial-kpi {
  min-height: 128px;
  padding: 16px 17px;
  border: 1px solid #e7e3ee;
  border-top: 1px solid #e7e3ee;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(66,52,112,.055);
  transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease;
}
.kvpl-modern-shell .industrial-kpi:nth-child(4n+1) { background: linear-gradient(145deg,#fff,#f1edff); }
.kvpl-modern-shell .industrial-kpi:nth-child(4n+2) { background: linear-gradient(145deg,#fff,#eafaf7); }
.kvpl-modern-shell .industrial-kpi:nth-child(4n+3) { background: linear-gradient(145deg,#fff,#edf3ff); }
.kvpl-modern-shell .industrial-kpi:nth-child(4n+4) { background: linear-gradient(145deg,#fff,#fff4e7); }
.kvpl-modern-shell .industrial-kpi::after { display: none; }
.kvpl-modern-shell a.industrial-kpi:hover {
  transform: translateY(-3px);
  border-color: #d4cff0;
  box-shadow: var(--modern-shadow-hover);
}
.kvpl-modern-shell .kpi-top span { color: #817d8f; font-size: 8px; letter-spacing: .62px; }
.kvpl-modern-shell .kpi-top i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.74);
  color: #7467d3;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(66,52,112,.06);
}
.kvpl-modern-shell .kpi-value { margin-top: 11px; color: #262233; font-size: 25px; font-weight: 700; }
.kvpl-modern-shell .kpi-foot { margin-top: 10px; color: #938f9e; font-size: 8.5px; }
.kvpl-modern-shell .kpi-foot strong { color: #5d586a; }
.kvpl-modern-shell .kpi-meter { height: 5px; border-radius: 999px; background: rgba(123,109,232,.12); }
.kvpl-modern-shell .kpi-meter span { border-radius: 999px; background: linear-gradient(90deg,var(--modern-teal),var(--modern-purple)); }

.kvpl-modern-shell .industrial-panel {
  border: 1px solid #e7e3ee;
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--modern-shadow);
}
.kvpl-modern-shell .industrial-panel-head {
  min-height: 61px;
  padding: 14px 17px;
  border-color: #efedf4;
  background: rgba(252,251,254,.87);
}
.kvpl-modern-shell .industrial-panel-head.compact { min-height: 57px; }
.kvpl-modern-shell .panel-eyebrow { color: #9a96a4; font-size: 7.5px; }
.kvpl-modern-shell .industrial-panel-head h2 { color: #373343; font-size: 11.5px; }
.kvpl-modern-shell .panel-legend-note { color: #9a96a5; font-size: 8px; }
.kvpl-modern-shell .panel-count {
  border-radius: 999px;
  background: var(--modern-purple-soft);
  color: var(--modern-purple-deep);
}
.kvpl-modern-shell .panel-count.danger { background: var(--modern-red-soft); color: #bb5361; }
.kvpl-modern-shell .panel-count.warning { background: var(--modern-amber-soft); color: #a66c20; }
.kvpl-modern-shell .panel-link { color: var(--modern-purple-deep); }
.kvpl-modern-shell .industrial-panel-body { padding: 17px; }
.kvpl-modern-shell .chart-body { min-height: 322px; }

.kvpl-modern-shell .currency-value-grid { gap: 12px; }
.kvpl-modern-shell .currency-value-card {
  border: 1px solid #e7e3ee;
  border-radius: 16px;
  background: linear-gradient(145deg,#fff,#f6f3ff);
  box-shadow: 0 6px 18px rgba(66,52,112,.045);
}
.kvpl-modern-shell .currency-value-card:hover { border-color: #d0c9f2; box-shadow: var(--modern-shadow-hover); }
.kvpl-modern-shell .currency-value-head { border-color: #ece8f4; }
.kvpl-modern-shell .currency-value-head strong { color: var(--modern-teal-deep); }
.kvpl-modern-shell .value-data-note { border-radius: 12px; }

.kvpl-modern-shell .due-bucket-grid { gap: 12px; }
.kvpl-modern-shell .due-bucket-card {
  border: 1px solid #e7e3ee;
  border-left: 1px solid #e7e3ee;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(66,52,112,.045);
}
.kvpl-modern-shell .due-bucket-7 { background: linear-gradient(145deg,#fff,var(--modern-red-soft)); }
.kvpl-modern-shell .due-bucket-15 { background: linear-gradient(145deg,#fff,var(--modern-amber-soft)); }
.kvpl-modern-shell .due-bucket-30 { background: linear-gradient(145deg,#fff,var(--modern-blue-soft)); }
.kvpl-modern-shell .due-bucket-card:hover { box-shadow: var(--modern-shadow-hover); }

.kvpl-modern-shell .factory-control-grid { gap: 12px; padding: 16px; }
.kvpl-modern-shell .factory-control-card {
  border: 1px solid #e8e4ef;
  border-radius: 16px;
  background: linear-gradient(145deg,#fff,#faf9fd);
  box-shadow: 0 6px 17px rgba(66,52,112,.04);
}
.kvpl-modern-shell .factory-control-card:hover { border-color: #d8d1f2; box-shadow: var(--modern-shadow-hover); }
.kvpl-modern-shell .industrial-progress,
.kvpl-modern-shell .micro-progress,
.kvpl-modern-shell .aging-bar { border-radius: 999px; background: #efedf5; }
.kvpl-modern-shell .industrial-progress span,
.kvpl-modern-shell .micro-progress span,
.kvpl-modern-shell .aging-bar span { border-radius: 999px; background: linear-gradient(90deg,var(--modern-teal),var(--modern-purple)); }
.kvpl-modern-shell .micro-progress.grade span { background: linear-gradient(90deg,var(--modern-blue),var(--modern-purple)); }
.kvpl-modern-shell .attention-item:hover,
.kvpl-modern-shell .concentration-item:hover,
.kvpl-modern-shell .aging-row:hover { background: #faf8ff; }

/* Reports, notification centre and admin catalogue use the same workspace style */
.kvpl-modern-shell .report-suite-hero {
  border: 1px solid #dfd9f5;
  border-radius: 20px;
  color: #2f2b40;
  background:
    radial-gradient(circle at 90% 10%, rgba(123,109,232,.20), transparent 32%),
    linear-gradient(135deg,#fff,#eefbf8);
  box-shadow: var(--modern-shadow);
}
.kvpl-modern-shell .report-suite-kicker { color: var(--modern-teal-deep); }
.kvpl-modern-shell .report-suite-hero p { color: #777287; }
.kvpl-modern-shell .report-suite-hero-stat { border-color: #d9d2f4; background: rgba(255,255,255,.65); }
.kvpl-modern-shell .report-suite-hero-stat span { color: #827d90; }
.kvpl-modern-shell .report-catalogue-card {
  border-color: #e6e2ed;
  border-top: 1px solid #e6e2ed;
  border-radius: 17px;
  box-shadow: var(--modern-shadow);
}
.kvpl-modern-shell .report-catalogue-card:hover { border-color: #d3ccf2; box-shadow: var(--modern-shadow-hover); }
.kvpl-modern-shell .report-catalogue-icon { background: var(--modern-teal-soft); color: var(--modern-teal-deep); }
.kvpl-modern-shell .notification-dropdown { border-color: #e6e2ed; border-radius: 16px; }
.kvpl-modern-shell .notification-dropdown-head { border-color: #efecf4; background: #fbfafe; }
.kvpl-modern-shell .notification-preview:hover,
.kvpl-modern-shell .notification-centre-item:hover,
.kvpl-modern-shell .notification-due-list a:hover { background: #faf8ff; }

/* Mobile */
.kvpl-modern-shell .kvpl-topbar {
  height: 58px;
  background: rgba(255,255,255,.92);
  border-color: #e6e2ed;
  backdrop-filter: blur(16px);
}
.mobile-brand-copy { min-width: 0; flex: 1; }
.kvpl-modern-shell .mobile-live { color: #9995a5; }
.kvpl-modern-shell .mobile-live span { background: var(--modern-teal); }

@media (max-width: 1250px) {
  .kvpl-modern-shell .industrial-kpi-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .modern-dashboard-hero { grid-template-columns: minmax(0,1fr) 320px; }
}
@media (max-width: 991.98px) {
  .kvpl-modern-shell .kvpl-sidebar { transform: translateX(-100%); }
  .kvpl-modern-shell .kvpl-sidebar.open { transform: translateX(0); }
  .kvpl-modern-shell .kvpl-main { margin-left: 0; }
  .kvpl-modern-shell .content-wrapper { padding: 74px 14px 35px; }
  .modern-dashboard-hero { grid-template-columns: 1fr; }
  .kvpl-modern-shell .industrial-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 575.98px) {
  .dashboard-greeting { min-height: 0; padding: 21px 18px; border-radius: 18px; }
  .dashboard-greeting h1 { font-size: 27px; }
  .dashboard-greeting p { font-size: 17px; }
  .dashboard-scope-card { padding: 18px; border-radius: 18px; }
  .dashboard-quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-action { justify-content: center; padding-left: 9px; padding-right: 9px; }
  .kvpl-modern-shell .industrial-kpi-grid { grid-template-columns: 1fr; }
  .kvpl-modern-shell .dashboard-meta-strip { overflow-x: auto; white-space: nowrap; }
}

/* ================================================================
   Phase 3.7.1 – Modern UI Refinement V2
   Operational screens, approval workspace and dashboard charts
   ================================================================ */

.workspace-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--modern-teal-deep, #189a8a);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .85px;
  text-transform: uppercase;
}

/* Refined dashboard charts */
.dashboard-chart-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at 95% 0%, rgba(123,109,232,.10), transparent 32%),
    rgba(255,255,255,.96) !important;
}
.dashboard-chart-head {
  align-items: flex-start !important;
  gap: 16px;
}
.chart-head-copy {
  max-width: 560px;
  margin: 4px 0 0;
  color: #928d9d;
  font-size: 8.5px;
  line-height: 1.45;
}
.chart-view-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 350px;
}
.chart-switch {
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid #e1ddec;
  border-radius: 999px;
  color: #777180;
  background: rgba(255,255,255,.92);
  font-size: 8.5px;
  font-weight: 700;
  transition: all .16s ease;
}
.chart-switch:hover { border-color: #cfc7ef; color: #5e53b9; }
.chart-switch.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg,#36c7b4,#7b6de8);
  box-shadow: 0 6px 16px rgba(108,126,225,.22);
}
.delivery-chart-summary {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 1px;
  margin: 0 17px;
  overflow: hidden;
  border: 1px solid #ebe7f2;
  border-radius: 14px;
  background: #ebe7f2;
}
.delivery-chart-summary > div {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255,255,255,.96);
}
.delivery-chart-summary span,
.status-total-orb span,
.status-summary-copy span {
  display: block;
  color: #9994a3;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.delivery-chart-summary strong {
  display: block;
  margin-top: 4px;
  color: #3f394d;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.refined-chart-body {
  position: relative;
  min-height: 285px !important;
  padding: 18px 18px 8px !important;
}
.refined-chart-body canvas { min-height: 250px; }
.chart-panel-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px 13px;
  color: #9893a2;
  border-top: 1px solid #f0edf5;
  font-size: 8px;
}
.chart-panel-foot i { color: #7467d3; }
.status-chart-summary {
  display: grid;
  grid-template-columns: 112px minmax(0,1fr);
  align-items: center;
  gap: 13px;
  padding: 13px 16px 4px;
}
.status-total-orb {
  display: grid;
  place-items: center;
  min-height: 82px;
  padding: 10px;
  border-radius: 17px;
  text-align: center;
  background: linear-gradient(145deg,#eefcf9,#f2efff);
  border: 1px solid #e0daf4;
}
.status-total-orb strong {
  margin-top: 3px;
  color: #51476d;
  font-size: 26px;
  line-height: 1;
}
.status-summary-copy strong {
  display: block;
  margin-top: 4px;
  color: #3e3949;
  font-size: 12px;
}
.status-summary-copy small {
  display: block;
  margin-top: 5px;
  color: #9b96a5;
  font-size: 8px;
  line-height: 1.4;
}
.refined-status-chart-wrap {
  display: grid;
  grid-template-columns: minmax(0,1.2fr) minmax(115px,.8fr);
  gap: 14px;
  min-height: 255px;
  padding: 10px 16px 16px !important;
}
.refined-status-chart-wrap canvas { min-height: 225px; }
.refined-status-legend {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.refined-status-legend a {
  min-height: 30px;
  padding: 7px 8px;
  border-radius: 9px;
}
.refined-status-legend a:hover { background: #f7f4ff; }

/* Contract register */
.contract-register-hero,
.approval-workspace-hero,
.contract-detail-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 14px;
  padding: 23px 25px;
  border: 1px solid #e3def0;
  border-radius: 21px;
  background:
    radial-gradient(circle at 92% 5%, rgba(123,109,232,.18), transparent 31%),
    radial-gradient(circle at 5% 100%, rgba(54,199,180,.13), transparent 30%),
    linear-gradient(145deg,#fff,#faf8ff);
  box-shadow: 0 14px 34px rgba(67,51,112,.07);
}
.contract-register-hero h1,
.approval-workspace-hero h1 {
  margin: 0;
  color: #302a3c;
  font-size: 27px;
  line-height: 1.1;
}
.contract-register-hero p,
.approval-workspace-hero p {
  max-width: 650px;
  margin: 8px 0 0;
  color: #80798b;
  font-size: 10px;
  line-height: 1.55;
}
.contract-register-hero-actions { display: flex; gap: 8px; margin-top: 15px; }
.contract-register-stats,
.approval-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3,minmax(105px,1fr));
  gap: 8px;
}
.contract-register-stats > div,
.approval-hero-metrics > div {
  min-width: 105px;
  padding: 13px 14px;
  border: 1px solid rgba(218,212,236,.9);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
}
.contract-register-stats span,
.approval-hero-metrics span {
  display: block;
  color: #9993a2;
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.contract-register-stats strong,
.approval-hero-metrics strong {
  display: block;
  margin-top: 4px;
  color: #484057;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.refined-workflow-tabs {
  gap: 6px;
  padding: 5px;
  border: 1px solid #e8e3ef;
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 7px 20px rgba(66,52,112,.035);
}
.refined-workflow-tabs .tab-btn {
  border-radius: 10px;
  border: 0;
}
.refined-workflow-tabs .tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg,#36c7b4,#7b6de8);
  box-shadow: 0 6px 14px rgba(108,126,225,.18);
}
.refined-filter-panel {
  overflow: hidden;
  border-color: #e5e0ed;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(67,51,112,.05);
  transition: max-height .22s ease, opacity .18s ease, margin .22s ease;
}
.refined-filter-panel.filters-collapsed {
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
}
.refined-result-summary {
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid #eae6f0;
  border-radius: 12px;
  background: rgba(255,255,255,.82);
}
.refined-register-card {
  overflow: hidden;
  border-color: #e5e0ed !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 30px rgba(67,51,112,.055) !important;
}
.refined-register-card thead th {
  background: #f8f6fb;
  color: #746e7f;
}
.refined-register-card tbody tr { transition: background .14s ease; }
.refined-register-card tbody tr:hover { background: #faf8ff; }

/* Contract editor */
.workspace-page-header { margin-bottom: 16px; }
.contract-editor-layout {
  display: grid;
  grid-template-columns: 220px minmax(0,1120px);
  gap: 16px;
  align-items: start;
}
.contract-editor-rail {
  position: sticky;
  top: 82px;
  overflow: hidden;
  border: 1px solid #e5e0ed;
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 28px rgba(67,51,112,.05);
}
.editor-rail-head {
  padding: 16px;
  border-bottom: 1px solid #eeeaf3;
  background: linear-gradient(145deg,#fbfaff,#eefbf8);
}
.editor-rail-head span { display:block; color:#9993a2; font-size:7.5px; font-weight:700; text-transform:uppercase; letter-spacing:.55px; }
.editor-rail-head strong { display:block; margin-top:4px; color:#3f394c; font-size:13px; }
.contract-editor-rail nav { display:flex; flex-direction:column; padding:8px; }
.contract-editor-rail nav a {
  display:grid;
  grid-template-columns:28px minmax(0,1fr);
  gap:9px;
  align-items:center;
  padding:10px 9px;
  border-radius:11px;
  color:#645e6d;
  text-decoration:none;
}
.contract-editor-rail nav a > span {
  width:26px; height:26px; display:grid; place-items:center;
  border-radius:9px; color:#8d8698; background:#f1eef5;
  font-size:9px; font-weight:800;
}
.contract-editor-rail nav a strong { display:block; font-size:9.5px; }
.contract-editor-rail nav a small { display:block; margin-top:2px; color:#aaa4b1; font-size:7.5px; }
.contract-editor-rail nav a.active { color:#5146aa; background:#f5f2ff; }
.contract-editor-rail nav a.active > span { color:#fff; background:linear-gradient(135deg,#36c7b4,#7b6de8); }
.editor-rail-tip {
  display:flex; gap:9px; align-items:flex-start;
  margin:0 10px 10px; padding:11px;
  border-radius:12px; color:#696274; background:#f3fbf9;
  font-size:8px; line-height:1.45;
}
.editor-rail-tip i { color:#22a891; font-size:13px; }
.contract-editor-card {
  width:100%;
  max-width:none !important;
  overflow:visible;
  border-color:#e5e0ed !important;
  border-radius:19px !important;
  box-shadow:0 13px 32px rgba(67,51,112,.055) !important;
}
.contract-editor-card > .card-body { padding:18px; }
.contract-editor-card .contract-section-card {
  scroll-margin-top:90px;
  margin-bottom:14px;
  padding:18px;
  border:1px solid #ebe7f1;
  border-radius:16px;
  background:linear-gradient(145deg,#fff,#fcfbfe);
}
.contract-editor-card .form-section-label {
  color:#494252;
  font-size:10px;
  letter-spacing:.15px;
}
.contract-editor-card .form-section-label i { color:#7064d6; }
.contract-editor-card .grade-row,
.contract-editor-card .alloc-row {
  border-radius:11px;
}
.contract-editor-card .total-qty-bar {
  border-radius:12px;
  background:linear-gradient(135deg,#f0fcf9,#f4f1ff);
}
.contract-form-actions {
  position:sticky;
  z-index:20;
  bottom:10px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  padding:12px 14px;
  border:1px solid #ddd7eb;
  border-radius:15px;
  background:rgba(255,255,255,.94);
  box-shadow:0 14px 36px rgba(50,39,85,.16);
  backdrop-filter:blur(14px);
}
.contract-form-action-copy { display:flex; gap:9px; align-items:center; min-width:0; }
.contract-form-action-copy > span { color:#31b49e; font-size:16px; }
.contract-form-action-copy strong { display:block; color:#474050; font-size:9px; }
.contract-form-action-copy small { display:block; margin-top:2px; color:#9993a2; font-size:7.5px; }

/* Contract detail workspace */
.contract-detail-header .page-title { display:none; }
.contract-detail-hero { grid-template-columns:minmax(0,1fr) minmax(430px,.85fr); }
.contract-detail-number { color:#302a3c; font-size:29px; font-weight:760; letter-spacing:-.7px; }
.contract-detail-customer { margin-top:3px; color:#625b6d; font-size:13px; font-weight:650; }
.contract-detail-meta { display:flex; flex-wrap:wrap; gap:11px 17px; margin-top:13px; color:#898391; font-size:8.5px; }
.contract-detail-meta span { display:flex; align-items:center; gap:5px; }
.contract-detail-meta i { color:#7467d3; }
.contract-detail-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.contract-detail-metrics > div { padding:12px 13px; border:1px solid rgba(220,214,236,.9); border-radius:14px; background:rgba(255,255,255,.76); }
.contract-detail-metrics span { display:block; color:#9993a2; font-size:7.5px; font-weight:700; text-transform:uppercase; letter-spacing:.45px; }
.contract-detail-metrics strong { display:block; margin-top:4px; color:#464052; font-size:14px; }
.hero-progress { height:5px; margin-top:7px; overflow:hidden; border-radius:999px; background:#ece8f2; }
.hero-progress span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,#36c7b4,#7b6de8); }
.approval-progress-card {
  margin-bottom:14px;
  padding:15px 17px 17px;
  border:1px solid #e5e0ed;
  border-radius:18px;
  background:rgba(255,255,255,.94);
  box-shadow:0 9px 25px rgba(67,51,112,.045);
}
.approval-progress-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px; }
.approval-progress-head strong { display:block; color:#40394b; font-size:12px; }
.approval-progress-track { display:flex; align-items:center; }
.approval-step { display:flex; align-items:center; gap:8px; min-width:125px; }
.approval-step > span { width:29px; height:29px; flex:0 0 29px; display:grid; place-items:center; border:2px solid #e1ddea; border-radius:50%; color:#9993a3; background:#fff; font-size:9px; font-weight:800; }
.approval-step strong { display:block; color:#5c5565; font-size:8.5px; white-space:nowrap; }
.approval-step small { display:block; max-width:105px; margin-top:2px; color:#a39da9; font-size:7px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.approval-step.completed > span { border-color:#35bea8; color:#fff; background:#35bea8; }
.approval-step.current > span { border-color:#7b6de8; color:#fff; background:#7b6de8; box-shadow:0 0 0 5px rgba(123,109,232,.10); }
.approval-line { flex:1; min-width:22px; height:2px; margin:0 7px; background:#e7e3ec; }
.approval-line.completed { background:linear-gradient(90deg,#35bea8,#7b6de8); }
.refined-contract-section-tabs { top:64px; border-radius:13px; box-shadow:0 7px 22px rgba(67,51,112,.07); }
.refined-delivery-entry { overflow:hidden; border-color:#d9d3eb !important; border-radius:17px !important; background:linear-gradient(145deg,#fff,#f2fcfa); }
.refined-delivery-entry .card-header { background:transparent; }

/* Approval workspace */
.approval-control-note {
  display:flex; align-items:flex-start; gap:11px;
  margin-bottom:14px; padding:13px 15px;
  border:1px solid #d9d3eb; border-radius:14px;
  color:#665f70; background:#f7f4ff;
}
.approval-control-note > i { color:#7165d7; font-size:17px; }
.approval-control-note strong { display:block; color:#453e52; font-size:9.5px; }
.approval-control-note span { display:block; margin-top:3px; font-size:8px; line-height:1.45; }
.approval-workspace-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(350px,.8fr); gap:14px; }
.approval-workspace-grid.level-2-only { grid-template-columns:1fr; }
.approval-queue-panel { overflow:hidden; border:1px solid #e5e0ed; border-radius:18px; background:rgba(255,255,255,.95); box-shadow:0 11px 29px rgba(67,51,112,.05); }
.approval-queue-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:15px 17px; border-bottom:1px solid #eeeaf3; background:#fbfafe; }
.approval-queue-head h2 { margin:0; color:#40394a; font-size:12px; }
.approval-count { min-width:29px; height:29px; display:grid; place-items:center; border-radius:999px; color:#5d51bb; background:#ede9ff; font-size:10px; font-weight:800; }
.approval-card-list { display:flex; flex-direction:column; gap:8px; padding:11px; }
.approval-decision-card { display:grid; grid-template-columns:38px minmax(0,1fr) auto; gap:11px; align-items:center; padding:13px; border:1px solid #ebe7f1; border-radius:14px; background:#fff; transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease; }
.approval-decision-card:hover { transform:translateY(-2px); border-color:#d6cfee; box-shadow:0 9px 22px rgba(70,53,115,.07); }
.approval-card-icon { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; color:#675ac8; background:#f0edff; font-size:15px; }
.amendment-decision-card .approval-card-icon { color:#179a87; background:#eafaf7; }
.approval-card-title { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.approval-card-title a { color:#3e374b; font-size:10.5px; font-weight:750; text-decoration:none; }
.approval-card-customer { margin-top:3px; color:#68616f; font-size:9px; font-weight:600; }
.approval-card-reason { margin-top:5px; color:#89828e; font-size:8px; line-height:1.4; }
.approval-card-meta { display:flex; flex-wrap:wrap; gap:6px 12px; margin-top:7px; color:#9a94a2; font-size:7.5px; }
.approval-card-meta span { display:flex; align-items:center; gap:4px; }
.approval-card-meta .approval-completed { color:#239c86; }
.approval-review-button { white-space:nowrap; }
.approval-empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:180px; padding:25px; text-align:center; }
.approval-empty-state i { color:#30af98; font-size:28px; }
.approval-empty-state strong { margin-top:9px; color:#4b4454; font-size:10px; }
.approval-empty-state span { margin-top:3px; color:#9b95a2; font-size:8px; }

@media (max-width: 1250px) {
  .contract-editor-layout { grid-template-columns:190px minmax(0,1fr); }
  .contract-detail-hero { grid-template-columns:1fr minmax(360px,.8fr); }
  .approval-progress-track { overflow-x:auto; padding-bottom:5px; }
  .approval-step { min-width:120px; }
}
@media (max-width: 991.98px) {
  .contract-register-hero,
  .approval-workspace-hero,
  .contract-detail-hero { grid-template-columns:1fr; }
  .contract-register-stats,
  .approval-hero-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .contract-editor-layout { grid-template-columns:1fr; }
  .contract-editor-rail { position:static; }
  .contract-editor-rail nav { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); overflow-x:auto; }
  .contract-editor-rail nav a { min-width:145px; }
  .editor-rail-tip { display:none; }
  .approval-workspace-grid { grid-template-columns:1fr; }
  .refined-status-chart-wrap { grid-template-columns:1fr; }
  .refined-status-legend { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 767.98px) {
  .delivery-chart-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-chart-head { flex-direction:column; }
  .chart-view-switch { justify-content:flex-start; max-width:none; }
  .contract-register-stats,
  .approval-hero-metrics,
  .contract-detail-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .approval-decision-card { grid-template-columns:36px minmax(0,1fr); }
  .approval-review-button { grid-column:1/-1; justify-content:center; }
  .contract-form-actions { position:static; align-items:stretch; flex-direction:column; }
  .contract-form-actions .d-flex { width:100%; }
  .contract-form-actions .btn { flex:1; }
}
@media (max-width: 575.98px) {
  .contract-register-hero,
  .approval-workspace-hero,
  .contract-detail-hero { padding:18px; border-radius:17px; }
  .contract-register-stats,
  .approval-hero-metrics { grid-template-columns:1fr 1fr; }
  .contract-register-stats > div:last-child,
  .approval-hero-metrics > div:last-child { grid-column:1/-1; }
  .delivery-chart-summary { margin:0 12px; }
  .refined-chart-body { padding-left:10px !important; padding-right:10px !important; }
  .status-chart-summary { grid-template-columns:90px minmax(0,1fr); }
  .refined-status-legend { grid-template-columns:1fr; }
  .contract-detail-meta { flex-direction:column; gap:7px; }
  .approval-progress-card { overflow:hidden; }
  .approval-progress-track { min-width:720px; }
}

/* ==========================================================
   Phase 3.7.2 – Modern UI Refinement V3
   Delivery, amendments, reports, alerts and administration
   ========================================================== */

/* Dashboard status chart – remove redundant legend and prevent overlap */
.status-performance-panel .status-chart-summary { padding-bottom: 8px; }
.refined-status-chart-wrap.status-chart-fullwidth {
  display: block;
  min-height: 288px;
  padding: 10px 16px 8px !important;
}
.refined-status-chart-wrap.status-chart-fullwidth canvas {
  display: block;
  width: 100% !important;
  min-height: 250px;
  max-height: 270px;
}
.status-chart-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px 14px;
  border-top: 1px solid #f0edf5;
  color: #928c9d;
  font-size: 9px;
  line-height: 1.45;
}
.status-chart-foot i { color: #6c7ee1; }

/* Delivery execution workspace */
.delivery-control-workspace {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #dfd9ee;
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 8%, rgba(108,126,225,.18), transparent 32%),
    radial-gradient(circle at 5% 100%, rgba(54,199,180,.14), transparent 33%),
    linear-gradient(145deg,#fff,#faf9ff);
  box-shadow: 0 16px 38px rgba(65,49,108,.08);
}
.delivery-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 24px 25px 17px;
}
.delivery-control-head h2 { margin: 3px 0 5px; color: #312b3d; font-size: 23px; }
.delivery-control-head p { max-width: 710px; margin: 0; color: #847e8d; font-size: 10px; line-height: 1.65; }
.delivery-progress-ring {
  --progress-color: #31b89f;
  position: relative;
  display: grid;
  flex: 0 0 104px;
  place-content: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  text-align: center;
  background:
    radial-gradient(circle at center,#fff 59%,transparent 60%),
    conic-gradient(var(--progress-color) calc(var(--delivery-progress) * 1%),#ebe8f3 0);
  box-shadow: inset 0 0 0 1px rgba(112,95,165,.08), 0 10px 24px rgba(52,42,86,.09);
}
.delivery-progress-ring strong { color: #403851; font-size: 20px; line-height: 1; }
.delivery-progress-ring span { margin-top: 3px; color: #96909e; font-size: 8px; }
.delivery-control-metrics {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  border-top: 1px solid rgba(222,216,236,.9);
  background: rgba(255,255,255,.72);
}
.delivery-control-metrics > div { min-height: 88px; padding: 17px 20px; border-right: 1px solid #ece8f3; }
.delivery-control-metrics > div:last-child { border-right: 0; }
.delivery-control-metrics span { display: block; color: #938d9b; font-size: 8px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.delivery-control-metrics strong { display: block; margin-top: 7px; color: #3f394a; font-size: 15px; }
.delivery-control-metrics small { display: block; margin-top: 3px; color: #aaa5b0; font-size: 8px; }
.delivery-authority-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #bfeadf;
  border-radius: 999px;
  color: #168c78;
  background: #effbf8;
  font-size: 8px;
  font-weight: 700;
}
.delivery-entry-layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(260px,.75fr); gap: 18px; padding: 18px; }
.delivery-entry-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.delivery-entry-form .delivery-allocation-field,
.delivery-entry-form .delivery-notes-field,
.delivery-entry-actions { grid-column: 1 / -1; }
.delivery-entry-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-top: 2px; }
.delivery-entry-actions > span { max-width: 430px; color: #9993a1; font-size: 8px; line-height: 1.5; }
.delivery-entry-actions > span i { margin-right: 4px; color: #6c7ee1; }
.delivery-allocation-preview {
  min-height: 100%;
  padding: 18px;
  border: 1px solid #e0dbea;
  border-radius: 18px;
  background: linear-gradient(160deg,#fbfaff,#f1fbf9);
}
.delivery-preview-empty { display: grid; min-height: 245px; place-content: center; justify-items: center; text-align: center; }
.delivery-preview-empty i { color: #7f71dc; font-size: 32px; }
.delivery-preview-empty strong { margin-top: 9px; color: #4e4759; font-size: 11px; }
.delivery-preview-empty span { max-width: 205px; margin-top: 4px; color: #9b95a3; font-size: 8px; line-height: 1.5; }
.delivery-preview-title { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid #e4dfeb; }
.delivery-preview-title div { display: grid; }
.delivery-preview-title strong { color: #423b4d; font-size: 12px; }
.delivery-preview-title small { color: #9c96a3; font-size: 8px; }
.delivery-preview-grid { display: grid; gap: 9px; margin-top: 14px; }
.delivery-preview-grid > div { padding: 12px; border: 1px solid #e6e1ee; border-radius: 12px; background: rgba(255,255,255,.78); }
.delivery-preview-grid span { display: block; color: #9993a1; font-size: 8px; }
.delivery-preview-grid strong { display: block; margin-top: 4px; color: #40394b; font-size: 12px; }
.delivery-preview-warning { display: flex; gap: 8px; margin-top: 12px; padding: 10px; border: 1px solid #ffd8a8; border-radius: 11px; color: #a9630d; background: #fff8eb; font-size: 8px; line-height: 1.45; }
.delivery-history-summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 16px; border-bottom: 1px solid #ece8f2; background: #fbfaff; }
.delivery-history-summary span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #e4deef; border-radius: 999px; color: #696273; background: #fff; font-size: 8px; }
.delivery-history-summary i { color: #6c7ee1; }
.delivery-sequence { display: inline-grid; width: 25px; height: 25px; place-items: center; border-radius: 8px; color: #6355bd; background: #f0edff; font-weight: 700; }
.currency-chip { display: inline-flex; padding: 2px 5px; border-radius: 5px; color: #177f6f; background: #ebfaf7; font-size: 8px; font-weight: 800; }

/* Amendment review */
.amendment-review-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(250px,.45fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
  padding: 23px 25px;
  border: 1px solid #e2dcec;
  border-radius: 22px;
  background: radial-gradient(circle at 90% 8%,rgba(123,109,232,.18),transparent 34%),linear-gradient(145deg,#fff,#faf8ff);
  box-shadow: 0 14px 34px rgba(67,51,112,.07);
}
.amendment-title-row { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.amendment-title-row h1 { margin: 0; color: #332d3f; font-size: 24px; }
.amendment-hero-copy > p { margin: 6px 0 0; color: #797382; font-size: 10px; }
.amendment-meta-line { display: flex; flex-wrap: wrap; gap: 8px 15px; margin-top: 13px; color: #918b98; font-size: 8px; }
.amendment-meta-line span { display: inline-flex; align-items: center; gap: 5px; }
.amendment-meta-line i { color: #6c7ee1; }
.amendment-control-note { display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid #c9e9df; border-radius: 16px; background: rgba(239,251,248,.9); }
.amendment-control-note > i { color: #23a98e; font-size: 25px; }
.amendment-control-note div { display: grid; }
.amendment-control-note span,.amendment-reason-card span { color: #8f8997; font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.amendment-control-note strong { margin-top: 3px; color: #347466; font-size: 12px; }
.amendment-control-note small { margin-top: 2px; color: #76a197; font-size: 8px; }
.amendment-reason-card { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 15px 18px; border: 1px solid #e2ddeb; border-radius: 16px; background: #fff; }
.amendment-reason-icon { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 12px; color: #6c5ed0; background: #f1eeff; }
.amendment-reason-card div:last-child { display: grid; }
.amendment-reason-card strong { margin-top: 3px; color: #443d4f; font-size: 11px; }
.amendment-reason-card small { margin-top: 2px; color: #9e98a4; font-size: 8px; }
.amendment-review-layout { display: grid; grid-template-columns: minmax(0,1fr) 285px; gap: 16px; align-items: start; }
.amendment-review-aside { position: sticky; top: 84px; }
.amendment-decision-card { padding: 18px; border: 1px solid #ded8e9; border-radius: 19px; background: #fff; box-shadow: 0 14px 32px rgba(65,49,108,.07); }
.amendment-decision-card h2 { margin: 5px 0 5px; color: #3d3648; font-size: 16px; }
.amendment-decision-card > p { color: #918b98; font-size: 8px; line-height: 1.55; }
.decision-form { display: grid; gap: 7px; margin-top: 14px; }
.decision-form label { color: #756e7d; font-size: 8px; font-weight: 700; }
.decision-divider { position: relative; margin: 12px 0; text-align: center; }
.decision-divider::before { content:""; position:absolute; left:0; right:0; top:50%; border-top:1px solid #ebe7f0; }
.decision-divider span { position: relative; padding: 0 8px; color: #aaa4af; background: #fff; font-size: 8px; }
.decision-state { display: grid; justify-items: center; margin-top: 18px; padding: 24px 12px; border-radius: 15px; text-align: center; background: #f7f6fa; }
.decision-state i { font-size: 28px; }
.decision-state strong { margin-top: 7px; color: #4b4455; }
.decision-state span { margin-top: 3px; color: #9993a0; font-size: 8px; }
.comparison-guide { display: inline-flex; align-items: center; gap: 5px; color: #8c8495; font-size: 8px; }
.comparison-guide i { color: #f0a04b; }
.amendment-comparison-table .comparison-changed td { background: #fffaf0; }
.amendment-comparison-table .comparison-changed td:first-child { box-shadow: inset 3px 0 #f0a04b; }
.change-pill { display: inline-flex; margin-left: 7px; padding: 2px 5px; border-radius: 999px; color: #a45c0a; background: #fff0cf; font-size: 7px; font-weight: 800; text-transform: uppercase; }
.amendment-allocation-list { display: grid; gap: 8px; padding: 13px; }
.amendment-allocation-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid #ebe7f1; border-radius: 12px; }
.amendment-allocation-item div { display: grid; }
.amendment-allocation-item strong { color: #4a4354; font-size: 9px; }
.amendment-allocation-item small { color: #9c96a3; font-size: 8px; }
.amendment-allocation-item > span:last-child { color: #4d4658; font-size: 9px; font-weight: 700; }
.amendment-upload-zone { background: #fbfaff; }
.document-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }

/* Report discovery */
.report-workspace-hero,
.alert-workspace-hero,
.admin-workspace-hero,
.automation-workspace-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 14px;
  padding: 23px 25px;
  border: 1px solid #e2dcec;
  border-radius: 22px;
  background: radial-gradient(circle at 91% 6%,rgba(111,98,220,.18),transparent 33%),radial-gradient(circle at 3% 100%,rgba(54,199,180,.12),transparent 30%),linear-gradient(145deg,#fff,#faf8ff);
  box-shadow: 0 14px 34px rgba(67,51,112,.07);
}
.report-workspace-hero h1,.alert-workspace-hero h1,.admin-workspace-hero h1,.automation-workspace-hero h1 { margin: 3px 0 5px; color: #312b3c; font-size: 24px; }
.report-workspace-hero p,.alert-workspace-hero p,.admin-workspace-hero p,.automation-workspace-hero p { max-width: 750px; margin: 0; color: #837d8b; font-size: 10px; line-height: 1.6; }
.report-hero-actions,.alert-hero-actions,.admin-hero-actions,.automation-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.report-workspace-stat { display: grid; min-width: 185px; justify-items: center; padding: 17px; border: 1px solid #ded7ee; border-radius: 18px; background: rgba(255,255,255,.82); text-align: center; }
.report-workspace-stat strong { color: #6154bf; font-size: 31px; line-height: 1; }
.report-workspace-stat span { margin-top: 5px; color: #4e4758; font-size: 9px; font-weight: 700; }
.report-workspace-stat small { margin-top: 3px; color: #9d97a3; font-size: 7px; }
.report-discovery-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; padding: 11px; border: 1px solid #e4dfee; border-radius: 16px; background: #fff; }
.report-search-box,.alert-search-box,.admin-user-toolbar > label,.master-record-toolbar > label { display: flex; align-items: center; gap: 8px; min-width: 245px; padding: 0 11px; border: 1px solid #dfd9e8; border-radius: 11px; background: #fbfaff; }
.report-search-box i,.alert-search-box i,.admin-user-toolbar > label i,.master-record-toolbar > label i { color: #8075cd; }
.report-search-box input,.alert-search-box input,.admin-user-toolbar input,.master-record-toolbar input { min-height: 36px; padding: 0; border: 0; outline: 0; background: transparent; font-size: 9px; }
.report-category-switch,.alert-severity-switch,.user-status-switch { display: flex; flex-wrap: wrap; gap: 5px; }
.report-category-switch button,.alert-severity-switch button,.user-status-switch button { min-height: 32px; padding: 0 10px; border: 1px solid #e0dbea; border-radius: 999px; color: #766f80; background: #fff; font-size: 8px; font-weight: 700; }
.report-category-switch button.active,.alert-severity-switch button.active,.user-status-switch button.active { border-color: #786be1; color: #fff; background: linear-gradient(135deg,#786be1,#6758c7); box-shadow: 0 5px 13px rgba(103,88,199,.2); }
.report-category-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin-bottom: 13px; }
.report-category-summary > div { display: grid; grid-template-columns: 34px minmax(0,1fr); column-gap: 9px; padding: 11px; border: 1px solid #e5e0ed; border-radius: 13px; background: #fff; }
.report-category-summary i { grid-row: 1/3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #6d60ce; background: #f0edff; }
.report-category-summary span { color: #9993a1; font-size: 7px; text-transform: uppercase; }
.report-category-summary strong { margin-top: 2px; color: #4c4556; font-size: 8px; }
.report-catalogue-refined .report-catalogue-card { position: relative; display: flex; flex-direction: column; min-height: 272px; }
.report-card-topline { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.report-category-label { padding: 3px 7px; border-radius: 999px; color: #6f64bd; background: #f0edff; font-size: 7px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.report-format-pills { display: flex; gap: 5px; color: #9b94a5; }
.report-catalogue-refined .report-catalogue-icon { margin-top: 13px; }
.report-card-actions { width: 100%; margin-top: auto; padding-top: 12px; }
.report-card-actions .btn { width: 100%; justify-content: center; }
.report-catalogue-empty,.alert-filter-empty { grid-column: 1/-1; display: grid; min-height: 220px; place-content: center; justify-items: center; color: #9993a1; text-align: center; }
.report-catalogue-empty i,.alert-filter-empty i { color: #8074d4; font-size: 28px; }
.report-catalogue-empty strong,.alert-filter-empty strong { margin-top: 8px; color: #4e4758; }
.report-catalogue-empty span,.alert-filter-empty span { margin-top: 3px; font-size: 8px; }

/* Alerts */
.alert-health-card,.automation-health-card,.master-hero-summary { display: flex; align-items: center; gap: 11px; min-width: 245px; padding: 15px; border: 1px solid #cde9e1; border-radius: 17px; background: rgba(240,251,248,.88); }
.alert-health-card > i,.automation-health-card > i,.master-hero-summary > i { color: #25aa90; font-size: 25px; }
.alert-health-card div,.automation-health-card div,.master-hero-summary div { display: grid; }
.alert-health-card span,.automation-health-card span,.master-hero-summary span { color: #87a59e; font-size: 7px; text-transform: uppercase; }
.alert-health-card strong,.automation-health-card strong,.master-hero-summary strong { margin-top: 3px; color: #347466; font-size: 11px; }
.alert-health-card small,.automation-health-card small,.master-hero-summary small { margin-top: 2px; color: #79a095; font-size: 7px; }
.alert-summary-refined { grid-template-columns: repeat(4,minmax(0,1fr)); }
.alert-summary-static { cursor: default; }
.alert-filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 11px; border: 1px solid #e4dfee; border-radius: 15px; background: #fff; }
.severity-dot { display: inline-block; width: 7px; height: 7px; margin-right: 3px; border-radius: 50%; }
.severity-critical { background: #b72e49; }.severity-danger { background: #e25d5d; }.severity-warning { background: #e7a62d; }.severity-info { background: #4f91df; }.severity-secondary { background: #8d8797; }
.persistent-alert-list-refined { padding: 12px; }
.persistent-alert-list-refined .persistent-alert { margin-bottom: 9px; border-radius: 15px; }
.alert-type-pill { padding: 3px 7px; border-radius: 999px; color: #6559ba; background: #f0edff; font-weight: 800; }
.alert-severity-label { margin-left: auto; font-weight: 800; }

/* Administration */
.admin-hero-metrics { display: grid; grid-template-columns: repeat(3,88px); gap: 7px; }
.admin-hero-metrics > div { display: grid; justify-items: center; padding: 13px 9px; border: 1px solid #e2dced; border-radius: 14px; background: rgba(255,255,255,.82); }
.admin-hero-metrics span { color: #96909e; font-size: 7px; text-transform: uppercase; }
.admin-hero-metrics strong { margin-top: 4px; color: #554a70; font-size: 20px; }
.admin-user-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 10px; border: 1px solid #e4dfee; border-radius: 15px; background: #fff; }
.user-identity-cell { display: flex; align-items: center; gap: 9px; }
.user-avatar-mini { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg,#7769dc,#4ebfae); font-weight: 800; }
.user-identity-cell div { display: grid; }
.user-identity-cell strong { color: #443d4e; font-size: 9px; }
.user-identity-cell small { color: #9d97a3; font-size: 8px; }
.user-row-actions { display: flex; gap: 5px; }
.master-tabs-refined { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-bottom: 13px; }
.master-tabs-refined .master-tab { display: flex; align-items: center; gap: 9px; min-height: 61px; padding: 10px; }
.master-tabs-refined .master-tab > span:last-child { display: grid; }
.master-tabs-refined .master-tab strong { font-size: 8px; }
.master-tabs-refined .master-tab small { color: #a29ca7; font-size: 7px; }
.master-tab-icon { display: grid; flex: 0 0 32px; height: 32px; place-items: center; border-radius: 10px; color: #6f62ca; background: #f0edff; }
.master-workspace-grid { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 14px; align-items: start; }
.master-create-panel { position: sticky; top: 84px; }
.master-create-copy { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #ece8f2; color: #918b98; font-size: 8px; line-height: 1.45; }
.master-create-copy i { color: #6c7ee1; }
.master-create-form { display: grid; gap: 11px; padding: 16px; }
.master-record-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; border-bottom: 1px solid #ece8f2; background: #fbfaff; }
.master-record-toolbar > span { color: #9993a1; font-size: 8px; }
.master-code { padding: 3px 6px; border-radius: 6px; color: #5f52b4; background: #f1eeff; font-weight: 700; }

/* Automation */
.automation-kpi-refined > div { min-height: 95px; }
.automation-kpi-refined small { display: block; margin-top: 4px; color: #aaa4af; font-size: 7px; }
.automation-workspace-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(280px,.65fr); gap: 14px; }
.schedule-card-list { display: grid; gap: 8px; padding: 12px; }
.schedule-card { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 12px; border: 1px solid #e7e2ed; border-radius: 14px; background: #fff; }
.schedule-card.schedule-paused { opacity: .67; background: #f8f7fa; }
.schedule-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: #6d5fc9; background: #f0edff; font-size: 18px; }
.schedule-copy { min-width: 0; }
.schedule-title-row { display: flex; align-items: center; gap: 8px; }
.schedule-title-row strong { color: #443d4f; font-size: 10px; }
.schedule-copy > span { display: block; margin-top: 2px; color: #8f8996; font-size: 8px; }
.schedule-meta { display: flex; flex-wrap: wrap; gap: 6px 11px; margin-top: 7px; color: #9a94a0; font-size: 7px; }
.schedule-meta span { display: inline-flex; align-items: center; gap: 4px; }
.schedule-meta i { color: #7265cd; }
.schedule-actions { display: flex; gap: 5px; }
.automation-alert-types-refined { padding: 12px; }
.automation-alert-types-refined > div { border-radius: 12px; }
.automation-alert-type-name { max-width: 150px; }
.severity-label { padding: 2px 5px; border-radius: 999px; }
.automation-run-type { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.automation-run-type i { color: #7063c9; }
.automation-run-summary { white-space: normal; color: #6d6675; background: transparent; font-size: 7px; }

@media (max-width: 1199.98px) {
  .delivery-control-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .delivery-control-metrics > div:nth-child(2) { border-right: 0; }
  .delivery-control-metrics > div:nth-child(-n+2) { border-bottom: 1px solid #ece8f3; }
  .amendment-review-layout { grid-template-columns: 1fr; }
  .amendment-review-aside,.master-create-panel { position: static; }
  .amendment-decision-card { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .amendment-decision-card > .panel-eyebrow,.amendment-decision-card > h2,.amendment-decision-card > p,.decision-state { grid-column: 1/-1; }
  .decision-divider { display: none; }
  .report-category-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .automation-workspace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 991.98px) {
  .report-workspace-hero,.alert-workspace-hero,.admin-workspace-hero,.automation-workspace-hero,.amendment-review-hero { grid-template-columns: 1fr; }
  .delivery-entry-layout { grid-template-columns: 1fr; }
  .delivery-allocation-preview { min-height: 0; }
  .delivery-preview-empty { min-height: 150px; }
  .report-discovery-bar,.alert-filter-bar,.admin-user-toolbar,.master-record-toolbar { align-items: stretch; flex-direction: column; }
  .report-search-box,.alert-search-box,.admin-user-toolbar > label,.master-record-toolbar > label { width: 100%; }
  .alert-summary-refined { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .master-tabs-refined { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .master-workspace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
  .delivery-control-head { align-items: flex-start; flex-direction: column; }
  .delivery-progress-ring { width: 88px; height: 88px; flex-basis: 88px; }
  .delivery-entry-form { grid-template-columns: 1fr; }
  .delivery-entry-form > * { grid-column: 1 !important; }
  .delivery-entry-actions { align-items: stretch; flex-direction: column; }
  .report-category-summary { grid-template-columns: 1fr; }
  .master-tabs-refined { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .schedule-card { grid-template-columns: 36px minmax(0,1fr); }
  .schedule-icon { width: 36px; height: 36px; }
  .schedule-actions { grid-column: 1/-1; justify-content: flex-end; }
  .amendment-decision-card { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .delivery-control-metrics { grid-template-columns: 1fr; }
  .delivery-control-metrics > div { border-right: 0; border-bottom: 1px solid #ece8f3; }
  .delivery-control-metrics > div:last-child { border-bottom: 0; }
  .alert-summary-refined { grid-template-columns: 1fr 1fr; }
  .admin-hero-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .report-workspace-stat,.alert-health-card,.automation-health-card,.master-hero-summary { min-width: 0; }
  .master-tabs-refined { grid-template-columns: 1fr 1fr; }
}

/* Phase 3.7.3 – final UI polish */
.panel-supporting-copy {
  margin: 4px 0 0;
  color: #958fa0;
  font-size: 8px;
  line-height: 1.45;
}
.automation-alert-types-final {
  display: grid;
  gap: 8px;
  padding: 12px;
}
.automation-alert-types-final .attention-clear {
  min-height: 190px;
}
.automation-alert-types-final > .automation-alert-row {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 38px minmax(72px,auto);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #ebe7f0;
  border-left: 3px solid #aaa4b3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(58,49,75,.035);
}
.automation-alert-types-final > .automation-alert-row:hover {
  border-color: #ddd7e7;
  box-shadow: 0 7px 18px rgba(58,49,75,.07);
}
.automation-alert-types-final > .automation-alert-row-critical { border-left-color: #b72e49; }
.automation-alert-types-final > .automation-alert-row-danger { border-left-color: #e25d5d; }
.automation-alert-types-final > .automation-alert-row-warning { border-left-color: #e7a62d; }
.automation-alert-types-final > .automation-alert-row-info { border-left-color: #4f91df; }
.automation-alert-types-final > .automation-alert-row-secondary { border-left-color: #8d8797; }
.automation-alert-symbol {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: #696273;
  background: #f4f2f7;
  font-size: 13px;
}
.automation-alert-types-final > .automation-alert-row-critical .automation-alert-symbol { color: #a3243f; background: #fff0f3; }
.automation-alert-types-final > .automation-alert-row-danger .automation-alert-symbol { color: #cb4545; background: #fff1f1; }
.automation-alert-types-final > .automation-alert-row-warning .automation-alert-symbol { color: #aa7414; background: #fff8e8; }
.automation-alert-types-final > .automation-alert-row-info .automation-alert-symbol { color: #357ac4; background: #edf6ff; }
.automation-alert-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.automation-alert-copy strong {
  overflow-wrap: anywhere;
  color: #3d3748;
  font-size: 10px;
  line-height: 1.25;
}
.automation-alert-copy small {
  color: #9a94a1;
  font-size: 7px;
}
.automation-alert-count {
  display: grid;
  width: 34px;
  height: 30px;
  place-items: center;
  justify-self: center;
  border: 1px solid #e5e0ea;
  border-radius: 10px;
  color: #443d50;
  background: #faf9fc;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.automation-severity-status {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 5px;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.automation-severity-status > span {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
}
.automation-alert-types-final .automation-severity-critical { color: #a92543; }
.automation-alert-types-final .automation-severity-danger { color: #c84545; }
.automation-alert-types-final .automation-severity-warning { color: #9a6a12; }
.automation-alert-types-final .automation-severity-info { color: #3378bc; }
.automation-alert-types-final .automation-severity-secondary { color: #716a7a; }

/* System-wide safeguards for the final responsive pass. */
.industrial-panel,
.workspace-card,
.table-wrap,
.schedule-copy,
.schedule-title-row,
.persistent-alert-content,
.contract-workspace-main {
  min-width: 0;
}
.table-wrap {
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}
.btn:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(108,96,210,.28);
  outline-offset: 2px;
}
.badge,
.automation-severity-status,
.alert-severity-label {
  text-wrap: nowrap;
}

@media (max-width: 420px) {
  .automation-alert-types-final > .automation-alert-row {
    grid-template-columns: 32px minmax(0,1fr) 34px;
    gap: 8px;
  }
  .automation-severity-status {
    grid-column: 2 / -1;
    justify-self: start;
  }
  .automation-alert-copy strong { font-size: 9px; }
  .automation-alert-count { width: 32px; height: 28px; }
}


/* Phase 3.8.0 – dynamic settings and configurable approval authority */
.settings-workspace-hero {
  display:flex; align-items:flex-end; justify-content:space-between; gap:24px;
  padding:28px 30px; margin-bottom:24px; border:1px solid #e6e7f2; border-radius:24px;
  background:linear-gradient(135deg,#ffffff 0%,#f7f5ff 54%,#eef9f6 100%);
  box-shadow:0 18px 44px rgba(76,67,122,.08);
}
.settings-workspace-hero h1 { margin:5px 0 8px; font-size:clamp(26px,3vw,38px); font-weight:800; letter-spacing:-.04em; }
.settings-workspace-hero p { max-width:760px; margin:0; color:#687087; }
.settings-hero-status { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:9px; max-width:480px; }
.settings-hero-status span { display:inline-flex; align-items:center; gap:7px; padding:9px 12px; border:1px solid #dedfed; border-radius:999px; background:rgba(255,255,255,.82); color:#3f4560; font-size:12px; font-weight:700; }
.settings-workspace-form { display:grid; gap:20px; padding-bottom:92px; }
.settings-panel { overflow:hidden; }
.settings-step-badge { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:#f0edff; color:#6255c7; font:700 12px/1 "IBM Plex Mono",monospace; }
.settings-panel-body { display:grid; grid-template-columns:minmax(220px,1fr) minmax(260px,420px); align-items:center; gap:28px; padding:24px; }
.settings-field-copy strong { display:block; margin-bottom:6px; color:#20243a; font-size:15px; }
.settings-field-copy p { margin:0; max-width:620px; color:#747b91; font-size:13px; }
.settings-control { margin:0; }
.settings-level-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; padding:24px; }
.settings-level-card { position:relative; display:grid; grid-template-columns:52px minmax(0,1fr); gap:16px; align-items:start; padding:22px; border:1px solid #e5e6f0; border-radius:18px; background:#fff; }
.settings-level-card.level-one { box-shadow:inset 4px 0 #6f61d8; }
.settings-level-card.level-two { box-shadow:inset 4px 0 #168a72; }
.settings-level-number { width:44px; height:44px; display:grid; place-items:center; border-radius:14px; background:#f2f0ff; color:#5d50c1; font-size:18px; font-weight:800; }
.settings-level-card.level-two .settings-level-number { background:#eaf8f4; color:#08755f; }
.settings-level-card .form-group { margin:0; }
.settings-allocation-note { display:flex; align-items:center; gap:10px; margin:20px 24px 0; padding:12px 14px; border:1px solid #dfe3f0; border-radius:14px; background:#f9faff; color:#646b82; font-size:12.5px; }
.settings-allocation-note i { color:#685bd0; font-size:17px; }
.settings-allocation-table th:nth-child(3), .settings-allocation-table th:nth-child(4),
.settings-allocation-choice { text-align:center; }
.settings-allocation-choice input { width:20px; height:20px; accent-color:#6255c7; cursor:pointer; }
.settings-save-bar { position:sticky; bottom:18px; z-index:20; display:flex; align-items:center; justify-content:space-between; gap:18px; padding:14px 16px 14px 18px; border:1px solid rgba(213,214,230,.92); border-radius:18px; background:rgba(255,255,255,.92); box-shadow:0 16px 42px rgba(47,45,80,.15); backdrop-filter:blur(14px); }
.settings-save-bar > div { display:flex; align-items:center; gap:8px; color:#71778c; font-size:12px; }
.approval-assignment-editor { display:grid; gap:10px; padding:15px; border:1px solid #e3e5ef; border-radius:15px; background:#fafaff; }
.approval-assignment-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.approval-assignment-head span { font-size:12px; font-weight:800; letter-spacing:.055em; text-transform:uppercase; color:#555c75; }
.approval-assignment-head small { color:#8a90a2; }
.approval-assignment-option { display:flex; gap:11px; align-items:flex-start; padding:12px; border:1px solid #e3e4ef; border-radius:12px; background:#fff; cursor:pointer; }
.approval-assignment-option input { width:18px; height:18px; margin-top:2px; accent-color:#6255c7; }
.approval-assignment-option span { display:grid; gap:2px; }
.approval-assignment-option strong { color:#30354c; font-size:13px; }
.approval-assignment-option small { color:#81879a; font-size:11px; }
.user-approval-tags { display:flex; flex-wrap:wrap; gap:5px; margin-top:7px; }
.approval-level-tag { display:inline-flex; align-items:center; max-width:240px; padding:4px 7px; border-radius:7px; font-size:10px; font-weight:700; line-height:1.25; }
.approval-level-tag.level-1 { background:#f0edff; color:#5d50c1; }
.approval-level-tag.level-2 { background:#e9f8f4; color:#08755f; }
@media (max-width:900px) {
  .settings-workspace-hero { align-items:flex-start; flex-direction:column; }
  .settings-hero-status { justify-content:flex-start; }
  .settings-panel-body,.settings-level-grid { grid-template-columns:1fr; }
}
@media (max-width:620px) {
  .settings-workspace-hero { padding:22px 18px; border-radius:18px; }
  .settings-panel-body,.settings-level-grid { padding:18px; }
  .settings-level-card { grid-template-columns:1fr; }
  .settings-allocation-table th:nth-child(2),.settings-allocation-table td:nth-child(2) { display:none; }
  .settings-save-bar { bottom:8px; align-items:stretch; flex-direction:column; }
  .settings-save-bar .btn { width:100%; }
}

/* Phase 3.8.1 – dynamic roles and permissions */
.role-governance-hero {
  background:
    radial-gradient(circle at 92% 10%, rgba(111,83,239,.15), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(246,248,255,.98));
}
.role-toolbar,
.admin-user-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:18px 0;
}
.role-toolbar > label,
.admin-user-toolbar > label {
  flex:1;
  max-width:520px;
  display:flex;
  align-items:center;
  gap:10px;
  background:#fff;
  border:1px solid #e5e7f1;
  border-radius:14px;
  padding:0 14px;
  box-shadow:0 8px 24px rgba(45,40,87,.05);
}
.role-toolbar input,
.admin-user-toolbar input {
  border:0!important;
  box-shadow:none!important;
  background:transparent!important;
  min-height:44px;
}
.role-card-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(310px,1fr));
  gap:18px;
}
.role-governance-card {
  background:#fff;
  border:1px solid #e5e7f1;
  border-radius:22px;
  padding:20px;
  box-shadow:0 14px 38px rgba(48,43,92,.07);
  display:flex;
  flex-direction:column;
  min-height:270px;
  transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;
}
.role-governance-card:hover {
  transform:translateY(-2px);
  border-color:#d6d0f8;
  box-shadow:0 18px 44px rgba(48,43,92,.1);
}
.role-governance-card.is-inactive { opacity:.72; background:#fafafd; }
.role-governance-card > header { display:flex; align-items:flex-start; gap:12px; }
.role-card-icon {
  width:44px;height:44px;border-radius:14px;display:grid;place-items:center;
  background:linear-gradient(135deg,#eeeaff,#e8f8fb);color:#6653dc;font-size:19px;flex:none;
}
.role-card-title { min-width:0; flex:1; }
.role-card-title > div { display:flex;align-items:center;gap:8px;flex-wrap:wrap; }
.role-card-title h2 { font-size:17px;margin:0;color:#242038; }
.role-card-title code { color:#746f88;font-size:11px;background:#f5f4fb;padding:3px 7px;border-radius:7px; }
.role-system-tag { font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#6c56df;background:#eeeaff;border-radius:999px;padding:3px 7px; }
.role-governance-card > p { color:#706b80;font-size:13px;line-height:1.6;margin:18px 0;min-height:42px; }
.role-card-metrics { display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:auto; }
.role-card-metrics > div { border:1px solid #eceaf4;background:#fafafe;border-radius:14px;padding:11px 13px; }
.role-card-metrics span { display:block;color:#8a849a;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:700; }
.role-card-metrics strong { display:block;font-size:20px;color:#29243e;margin-top:3px; }
.role-governance-card > footer { display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:16px;padding-top:15px;border-top:1px solid #efedf5; }
.role-governance-card > footer form { margin:0; }

.role-editor-form { display:grid;gap:18px; }
.role-identity-grid { padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:18px; }
.role-description-field { grid-column:1 / -1; }
.role-active-toggle {
  grid-column:1 / -1;display:flex;gap:12px;align-items:flex-start;border:1px solid #e4e1f0;
  border-radius:15px;padding:14px 16px;background:#faf9ff;cursor:pointer;
}
.role-active-toggle input { width:auto;margin-top:3px; }
.role-active-toggle span { display:flex;flex-direction:column;gap:3px; }
.role-active-toggle small { color:#7d778d; }
.permission-matrix-intro { color:#706b80;font-size:13px;margin:0;padding:0 20px 16px; }
.permission-matrix-actions { display:flex;gap:8px; }
.permission-category-grid { padding:0 20px 20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px; }
.permission-category-card { border:1px solid #e7e4f0;border-radius:18px;overflow:hidden;background:#fff; }
.permission-category-card > header { display:flex;justify-content:space-between;align-items:center;padding:14px 16px;background:#faf9fe;border-bottom:1px solid #ece9f4; }
.permission-category-card > header > div { display:flex;gap:9px;align-items:center;color:#39334c; }
.permission-category-toggle { border:0;background:transparent;color:#6b58df;font-size:11px;font-weight:700;padding:0; }
.permission-option-list { display:grid; }
.permission-option { display:grid;grid-template-columns:auto 1fr;gap:11px;padding:13px 15px;border-bottom:1px solid #f0eef6;cursor:pointer; }
.permission-option:last-child { border-bottom:0; }
.permission-option:hover { background:#fbfaff; }
.permission-option input { width:auto;margin-top:4px; }
.permission-option > span { display:grid;gap:3px; }
.permission-option strong { font-size:13px;color:#2c273f; }
.permission-option small { color:#7b758b;font-size:11.5px;line-height:1.45; }
.permission-option code { width:max-content;font-size:9.5px;color:#685bd0;background:#f1effd;border-radius:6px;padding:2px 5px; }
.permission-option-critical { background:rgba(226,63,85,.035); }
.role-form-actions { position:sticky;bottom:14px;z-index:4;display:flex;justify-content:flex-end;gap:10px;background:rgba(255,255,255,.93);backdrop-filter:blur(14px);border:1px solid #e5e2ef;border-radius:16px;padding:12px 14px;box-shadow:0 12px 34px rgba(45,40,87,.12); }

.role-assignment-heading { display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px; }
.role-assignment-heading > div { display:flex;flex-direction:column;gap:4px; }
.user-role-selector { display:grid;gap:9px; }
.user-role-option {
  display:grid;grid-template-columns:auto auto 1fr auto;gap:11px;align-items:center;
  border:1px solid #e5e2ef;border-radius:15px;padding:12px 13px;background:#fff;cursor:pointer;
}
.user-role-option:hover { border-color:#cfc7f8;background:#fbfaff; }
.user-role-option.is-inactive { opacity:.66;background:#f7f7fa; }
.user-role-option input { width:auto; }
.user-role-option-icon { width:34px;height:34px;border-radius:11px;display:grid;place-items:center;background:#f0edff;color:#6a56de; }
.user-role-option > span:nth-of-type(2) { display:grid;gap:2px; }
.user-role-option strong { font-size:13px;color:#2f2a43; }
.user-role-option small { color:#777187;font-size:11px;line-height:1.35; }
.user-role-option code { width:max-content;color:#7166bd;font-size:9px; }
.user-role-option em { font-style:normal;font-size:9px;text-transform:uppercase;letter-spacing:.06em;font-weight:800;color:#7061ce;background:#f0edff;border-radius:999px;padding:3px 7px; }
.user-role-tags { display:flex;flex-wrap:wrap;gap:5px;margin-bottom:7px; }
.user-role-tags .role-badge { max-width:210px;white-space:normal;line-height:1.25; }

@media (max-width: 767px) {
  .role-toolbar,.admin-user-toolbar { align-items:stretch;flex-direction:column; }
  .role-toolbar > label,.admin-user-toolbar > label { max-width:none;width:100%; }
  .role-card-grid { grid-template-columns:1fr; }
  .role-identity-grid { grid-template-columns:1fr;padding:16px; }
  .permission-category-grid { grid-template-columns:1fr;padding:0 14px 14px; }
  .permission-matrix-actions { width:100%;margin-top:9px; }
  .permission-matrix-actions .btn { flex:1; }
  .role-assignment-heading { flex-direction:column; }
  .user-role-option { grid-template-columns:auto auto 1fr; }
  .user-role-option em { grid-column:3;justify-self:start; }
  .role-form-actions { bottom:8px; }
}

/* Phase 3.8.3 – contract document and grade-line layout hotfix */
.document-upload-panel {
  container-type: inline-size;
  padding-top: 16px;
  padding-bottom: 16px;
}
.document-upload-grid {
  grid-template-columns:
    minmax(180px, .95fr)
    minmax(260px, 1.35fr)
    minmax(240px, 1.25fr)
    minmax(180px, .85fr)
    minmax(118px, .55fr);
  gap: 12px;
  align-items: start;
}
.document-upload-grid > .form-group {
  min-width: 0;
  margin-bottom: 0;
}
.document-upload-grid select,
.document-upload-grid input,
.document-upload-grid .btn {
  width: 100%;
  min-width: 0;
}
.document-upload-grid input[type="file"] {
  min-height: 38px;
  padding: 5px 8px;
}
.document-upload-action .btn {
  min-width: 118px;
  min-height: 38px;
  justify-content: center;
}
@container (max-width: 1080px) {
  .document-upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document-upload-action {
    grid-column: 2;
  }
}
@container (max-width: 620px) {
  .document-upload-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .document-upload-action {
    grid-column: 1;
  }
}

#contract-grades {
  container-type: inline-size;
}
#contract-grades .grade-row {
  grid-template-columns:
    minmax(145px, 1.85fr)
    minmax(80px, .82fr)
    minmax(84px, .88fr)
    minmax(74px, .76fr)
    minmax(72px, .72fr)
    minmax(72px, .72fr)
    minmax(96px, .92fr)
    38px;
  gap: 8px;
  max-width: 100%;
  padding: 10px;
  overflow: hidden;
}
#contract-grades .grade-row > select,
#contract-grades .grade-row > input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
#contract-grades .grade-row-header {
  overflow: visible;
  padding-top: 0;
  padding-bottom: 6px;
}
#contract-grades .grade-row-header > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#contract-grades .remove-grade-btn {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  padding-left: 0;
  padding-right: 0;
  justify-self: end;
}
@container (max-width: 760px) {
  #contract-grades .grade-row:not(.grade-row-header) {
    grid-template-columns: minmax(160px, 1.45fr) repeat(3, minmax(0, 1fr));
    overflow: visible;
  }
  #contract-grades .grade-row-header {
    display: none !important;
  }
}
@container (max-width: 520px) {
  #contract-grades .grade-row:not(.grade-row-header) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Phase 3.9.0 – document workflow, allocation layout and dispatch register */
.contract-po-upload {
  grid-column: span 2;
}
.contract-po-upload input[type="file"] {
  min-height: 42px;
  padding: 6px 9px;
}

#factory-allocations {
  container-type: inline-size;
}
#factory-allocations .alloc-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.35fr) minmax(170px, 1.35fr) minmax(105px, .72fr) 38px;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
#factory-allocations .alloc-row > select,
#factory-allocations .alloc-row > input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
#factory-allocations .remove-alloc-btn {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  padding-left: 0;
  padding-right: 0;
  justify-self: end;
}
#factory-allocations .alloc-row-header {
  display: grid !important;
  grid-template-columns: minmax(170px, 1.35fr) minmax(170px, 1.35fr) minmax(105px, .72fr) 38px;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@container (max-width: 650px) {
  #factory-allocations .alloc-row:not(.alloc-row-header) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
  #factory-allocations .alloc-row-header {
    display: none !important;
  }
  #factory-allocations .remove-alloc-btn {
    justify-self: start;
  }
}
@container (max-width: 420px) {
  #factory-allocations .alloc-row:not(.alloc-row-header) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sale-order-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 7px;
  align-items: center;
  margin-top: 4px;
}
.sale-order-inline-form input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
}
.sale-order-inline-form .btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
}

.document-register-wrap {
  overflow-x: auto;
}
.contract-document-table {
  min-width: 1120px;
}
.contract-document-table th:first-child,
.contract-document-table td:first-child {
  min-width: 205px;
}
.document-preview-link,
.document-original-link {
  border: 0;
  background: transparent;
  color: #5f4dc4;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.document-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.document-preview-link:hover,
.document-original-link:hover {
  color: #3f2ca9;
  text-decoration: underline;
}
.document-original-link,
.document-original-name {
  max-width: 260px;
  overflow-wrap: anywhere;
}
.document-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.document-actions form {
  margin: 0;
}
.document-preview-modal .modal-dialog {
  max-width: min(1280px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin-top: 16px;
  margin-bottom: 16px;
}
.document-preview-modal .modal-content {
  height: 100%;
  overflow: hidden;
}
.document-preview-body {
  padding: 0;
  min-height: 0;
  background: #eef0f6;
}
.document-preview-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 68vh;
  border: 0;
  background: #fff;
}

.delivery-history-workspace .table-wrap {
  overflow-x: auto;
}
.delivery-history-table {
  width: 100%;
  min-width: 1120px;
  table-layout: auto;
}
.delivery-history-table .delivery-factory-grade-column {
  min-width: 200px;
  width: 220px;
}
.delivery-factory-grade {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.delivery-factory-grade > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.delivery-factory-grade small {
  color: #837d90;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.delivery-factory-grade strong {
  color: #4a4454;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.delivery-history-table th:nth-child(8),
.delivery-history-table td:nth-child(8) {
  min-width: 150px;
}
.delivery-history-table .delivery-action-column {
  min-width: 96px;
  width: 96px;
}

@media (max-width: 767px) {
  .contract-po-upload {
    grid-column: span 1;
  }
  .document-preview-modal .modal-dialog {
    max-width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    margin: 8px;
  }
  .document-preview-body iframe {
    min-height: 72vh;
  }
}
