/* Procurement System - Modern Clean Styles */

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

:root {
  /* SINOQAT brand: red primary, near-black ink, white — matches the supplier portal */
  --primary: #E2231A;
  --primary-hover: #B91912;
  --primary-light: #FDECEA;
  --success: #0E9F6E;
  --warning: #F59E0B;
  --danger: #DC2626;
  --gray-50: #F7F8FA;
  --gray-100: #F1F2F4;
  --gray-200: #E6E8EC;
  --gray-300: #D5D8DD;
  --gray-400: #9AA0A6;
  --gray-500: #7A828C;
  --gray-600: #565E68;
  --gray-700: #3A4049;
  --gray-800: #23262B;
  --gray-900: #15171A;
  /* near-black sidebar (brand black), red active accent */
  --sidebar-bg: #18191D;
  --sidebar-text: #A8AEB7;
  --sidebar-hover: #25272D;
  --sidebar-active: #E2231A;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
}

#app {
  display: flex;
  height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  font-size: 18px;
  font-weight: 600;
  color: white;
  border-bottom: 1px solid var(--sidebar-hover);
}
.brand-icon { font-size: 24px; }

.lang-toggle {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-hover);
}
.lang-btn {
  flex: 1;
  padding: 6px 10px;
  background: var(--sidebar-hover);
  border: none;
  color: var(--sidebar-text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.lang-btn.active {
  background: var(--primary);
  color: white;
}

#nav {
  flex: 1;
  padding: 12px 0;
}
.nav-group {
  margin-bottom: 16px;
}
.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  padding: 0 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: white;
}
.nav-item-icon { font-size: 16px; }

.sidebar-footer {
  padding: 12px 20px;
  font-size: 11px;
  color: var(--gray-500);
  border-top: 1px solid var(--sidebar-hover);
}

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-900);
  margin-right: auto;
  flex-shrink: 0;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.btn { white-space: nowrap; }

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: var(--gray-50);
}

.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--gray-500);
}

/* ===== Buttons ===== */
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
  background: white;
  color: var(--gray-700);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--gray-100); }
.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); }

/* ===== Toolbar ===== */
.toolbar {
  background: white;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--gray-200);
}
.toolbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
}
.toolbar-right {
  display: flex;
  gap: 8px;
}
.search-input {
  padding: 7px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  width: 240px;
  outline: none;
}
.search-input:focus { border-color: var(--primary); }

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  overflow: hidden;
}
.view-toggle button {
  padding: 6px 12px;
  background: white;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-600);
}
.view-toggle button.active {
  background: var(--primary);
  color: white;
}

/* ===== Table ===== */
.table-wrap {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.data-table tbody tr:hover {
  background: var(--gray-50);
  cursor: pointer;
}
.data-table tbody tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-700);
}
.tag-success { background: #d1fae5; color: #065f46; }
.tag-warning { background: #fef3c7; color: #92400e; }
.tag-danger { background: #fee2e2; color: #991b1b; }
.tag-info { background: var(--primary-light); color: #1e40af; }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: white;
  border-top: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-600);
}
.pagination-controls { display: flex; gap: 4px; }

/* ===== Form ===== */
.form-wrap {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 24px;
}
.form-grid-full { grid-template-columns: 1fr; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field.full { grid-column: span 2; }
.form-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
}
.form-field label .required { color: var(--danger); }
.form-field input,
.form-field select,
.form-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-field textarea { min-height: 80px; resize: vertical; }
.form-field .checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
}

.multiselect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  min-height: 36px;
}
.multiselect-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.multiselect-tag button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.form-actions {
  padding: 14px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-section-title {
  grid-column: span 2;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 6px;
  margin-top: 8px;
}

/* Subform table */
.subform {
  grid-column: span 2;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 12px;
  background: var(--gray-50);
}
.subform-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.subform-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
.subform-table th {
  font-size: 11px;
  padding: 8px 10px;
  background: var(--gray-100);
  text-align: left;
}
.subform-table td {
  padding: 4px;
}
.subform-table td input,
.subform-table td select {
  width: 100%;
  border: 1px solid transparent;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 4px;
}
.subform-table td input:hover,
.subform-table td select:hover { border-color: var(--gray-300); }
.subform-table td input:focus,
.subform-table td select:focus { border-color: var(--primary); }

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: white;
  border-radius: 8px;
  padding: 18px;
  border: 1px solid var(--gray-200);
}
.kpi-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}
.kpi-icon {
  float: right;
  font-size: 28px;
  opacity: 0.4;
}

.dashboard-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dashboard-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--gray-200);
}
.dashboard-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--gray-800);
}

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 80px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.bar-bar {
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  height: 18px;
}
.bar-bar-fill {
  background: var(--primary);
  height: 100%;
  transition: width 0.3s;
}
.bar-value { text-align: right; font-weight: 500; }

.trend-chart {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 160px;
  padding-top: 16px;
}
.trend-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 4px;
  cursor: pointer;
}
.trend-bar:hover { background: var(--primary-hover); }
.trend-bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--gray-500);
  white-space: nowrap;
}
.trend-bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--gray-700);
  white-space: nowrap;
}

/* ===== Kanban ===== */
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
}
.kanban-col {
  flex: 0 0 280px;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 12px;
}
.kanban-col-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.kanban-col-count {
  background: var(--gray-300);
  color: var(--gray-700);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.kanban-card {
  background: white;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--gray-200);
}
.kanban-card:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.06); }
.kanban-card-title {
  font-weight: 500;
  margin-bottom: 4px;
}
.kanban-card-meta {
  font-size: 11px;
  color: var(--gray-500);
}

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal-content {
  position: relative;
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray-500);
  width: 32px;
  height: 32px;
  border-radius: 4px;
}
.btn-close:hover { background: var(--gray-100); }
.modal-body {
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--gray-50);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-800);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 200;
  animation: slideIn 0.2s;
}
.toast.hidden { display: none; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 12px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ===== Topbar extras (user menu, global search) ===== */
.topbar-extra {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.global-search { position: relative; }
.global-search input {
  width: 220px;
  padding: 7px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
@media (max-width: 1100px) {
  .global-search input { width: 150px; }
  .user-info-text { display: none; }
}
.global-search input:focus { border-color: var(--primary); }
.global-search-results {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  width: 380px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  max-height: 480px;
  overflow-y: auto;
  z-index: 50;
}
.search-group { padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.search-group:last-child { border-bottom: none; }
.search-group-title {
  font-size: 11px; color: var(--gray-500); font-weight: 600;
  padding: 4px 14px; text-transform: uppercase;
}
.search-group a {
  display: block; padding: 8px 14px;
  color: var(--gray-700); text-decoration: none; font-size: 13px;
}
.search-group a:hover { background: var(--gray-50); color: var(--primary); }
.search-empty { padding: 16px; text-align: center; color: var(--gray-400); font-size: 13px; }

.user-menu { position: relative; }
.user-info {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.user-info:hover { background: var(--gray-100); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}
.user-info-text { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 500; color: var(--gray-800); }
.user-role { font-size: 11px; color: var(--gray-500); }
.user-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  width: 180px; background: white;
  border: 1px solid var(--gray-200); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 50; padding: 6px 0;
}
.user-dropdown a {
  display: block; padding: 8px 14px;
  color: var(--gray-700); text-decoration: none; font-size: 13px;
}
.user-dropdown a:hover { background: var(--gray-50); color: var(--primary); }

/* ===== Detail view ===== */
.detail-header {
  background: white; border-radius: 8px;
  padding: 18px 24px; margin-bottom: 12px;
  border: 1px solid var(--gray-200);
}
.detail-title { font-size: 18px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.detail-code { font-size: 13px; color: var(--gray-500); font-family: ui-monospace, monospace; }
.detail-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  background: white; padding: 0 16px;
  border-radius: 8px 8px 0 0;
}
.detail-tabs .tab {
  padding: 12px 16px; background: transparent; border: none; cursor: pointer;
  font-size: 13px; color: var(--gray-600);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.detail-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.detail-content {
  background: white; border-radius: 0 0 8px 8px;
  padding: 20px; border: 1px solid var(--gray-200); border-top: none;
}
.detail-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 18px 24px; margin-bottom: 24px;
}
.detail-field { display: flex; flex-direction: column; gap: 4px; }
.detail-field label {
  font-size: 11px; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.detail-field > div { font-size: 14px; color: var(--gray-800); }
.detail-subform { margin-top: 24px; }
.detail-subform h3 {
  font-size: 14px; font-weight: 600;
  margin-bottom: 10px; color: var(--gray-700);
}

/* ===== Workflow bar ===== */
.workflow-bar {
  background: var(--primary-light);
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.workflow-bar-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}

/* ===== Attachments ===== */
.attach-section { padding: 8px 0; }
.attach-upload {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--gray-50);
  border-radius: 8px; margin-bottom: 16px;
}
.attach-upload input[type=file] { display: none; }
.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--gray-50);
  border-radius: 6px; border: 1px solid var(--gray-200);
}
.attach-icon { font-size: 20px; }
.attach-info { flex: 1; }
.attach-name { font-size: 13px; font-weight: 500; color: var(--gray-800); }
.attach-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.attach-actions { display: flex; gap: 6px; }

/* ===== Audit / Activity ===== */
.audit-list, .activity-feed { display: flex; flex-direction: column; gap: 8px; }
.audit-item {
  padding: 10px 14px; background: var(--gray-50);
  border-radius: 6px; border-left: 3px solid var(--primary);
}
.audit-meta { display: flex; gap: 12px; align-items: center; font-size: 12px; }
.audit-action { font-weight: 500; color: var(--gray-700); }
.audit-user { color: var(--primary); }
.audit-time { color: var(--gray-500); margin-left: auto; }
.audit-changes { margin-top: 8px; font-size: 12px; color: var(--gray-600); }
.audit-changes summary { cursor: pointer; color: var(--gray-500); margin-bottom: 4px; }
.audit-changes code {
  background: var(--gray-100); padding: 1px 4px;
  border-radius: 3px; font-size: 11px;
}

.activity-item {
  display: flex; gap: 12px; padding: 14px;
  background: white; border-radius: 8px;
  border: 1px solid var(--gray-200); align-items: flex-start;
}
.activity-icon {
  width: 32px; height: 32px; background: var(--primary-light);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-body { flex: 1; }
.activity-text { font-size: 13px; color: var(--gray-700); }
.activity-text a { color: var(--primary); text-decoration: none; }
.activity-text a:hover { text-decoration: underline; }
.activity-time { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ===== 360 View ===== */
.card360-header {
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  color: white; padding: 24px; border-radius: 10px;
  margin-bottom: 16px; display: grid;
  grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.card360-title { font-size: 22px; font-weight: 700; }
.card360-subtitle { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.card360-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.card360-stat { text-align: right; }
.card360-stat-label { font-size: 11px; opacity: 0.85; text-transform: uppercase; }
.card360-stat-value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.card360-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card360-section {
  background: white; border-radius: 8px;
  border: 1px solid var(--gray-200); padding: 16px 18px;
}
.card360-section h3 {
  font-size: 14px; font-weight: 600;
  margin-bottom: 10px; color: var(--gray-700);
}

/* ===== Aging ===== */
.aging-summary { display: flex; gap: 12px; margin-bottom: 16px; }
.aging-summary-card {
  background: white; border-radius: 8px;
  padding: 18px 24px; border: 1px solid var(--gray-200);
}
.aging-summary-label { font-size: 12px; color: var(--gray-500); }
.aging-summary-value { font-size: 24px; font-weight: 700; color: var(--primary); margin-top: 4px; }

/* ===== Todos ===== */
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item {
  background: white; border-radius: 8px;
  padding: 14px 18px; display: flex;
  align-items: center; gap: 14px;
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--primary);
}
.todo-item.todo-overdue { border-left-color: var(--danger); background: #fef2f2; }
.todo-check {
  width: 24px; height: 24px;
  border: 2px solid var(--gray-300); border-radius: 50%;
  background: white; cursor: pointer; font-size: 14px; color: transparent;
}
.todo-check:hover { border-color: var(--primary); background: var(--primary); color: white; }
.todo-info { flex: 1; }
.todo-title { font-size: 14px; color: var(--gray-800); font-weight: 500; }
.todo-meta { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.todo-meta a { color: var(--primary); text-decoration: none; }

/* ===== Settings / Company / Assets ===== */
.settings-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.settings-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.asset-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.asset-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 10px;
}
.asset-preview {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}
.asset-preview img { max-height: 96px; max-width: 100%; object-fit: contain; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .asset-grid { grid-template-columns: 1fr; }
  .brand-text, .lang-toggle, .sidebar-footer { display: none; }
  .nav-item span:last-child { display: none; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-section { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: span 1; }
  .form-section-title { grid-column: span 1; }
  .subform { grid-column: span 1; }
  .detail-grid { grid-template-columns: 1fr; }
  .card360-header { grid-template-columns: 1fr; }
  .card360-stats { grid-template-columns: repeat(2, 1fr); }
  .card360-grid { grid-template-columns: 1fr; }
  .global-search input { width: 160px; }
}

/* ===== Customer PI pricing screen (phase ③) ===== */
.pi-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px 16px;margin:14px 0 6px;}
@media(max-width:760px){.pi-grid{grid-template-columns:1fr 1fr;}}
.pi-section-title{font-weight:700;font-size:14px;margin:20px 0 8px;display:flex;align-items:center;gap:12px;color:var(--gray-800);}
.pi-table-wrap{overflow-x:auto;border:1px solid var(--gray-200);border-radius:8px;}
#pi-lines td,#pi-fees td{vertical-align:middle;}
#pi-lines .num,#pi-fees .num,.subform-table .num{text-align:right;font-variant-numeric:tabular-nums;}
#pi-lines .ctr,.subform-table .ctr{text-align:center;}
.pi-sub{font-size:11px;color:var(--gray-500);margin-top:2px;}
.pi-totals{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:18px;}
@media(max-width:680px){.pi-totals{grid-template-columns:1fr;}}
.pi-tot-internal,.pi-tot-customer{border:1px solid var(--gray-200);border-radius:10px;padding:14px 16px;background:var(--gray-50);}
.pi-tot-customer{background:#fff;}
.pi-tot-h{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--gray-500);font-weight:700;margin-bottom:8px;}
.pi-tot-row{display:flex;justify-content:space-between;align-items:center;padding:5px 0;font-size:13.5px;}
.pi-tot-row b{font-variant-numeric:tabular-nums;}
.pi-tot-row.pi-margin b{color:var(--success);font-size:15px;}
.pi-tot-row.pi-grand{border-top:2px solid var(--gray-800);margin-top:6px;padding-top:9px;}
.pi-tot-row.pi-grand b{font-size:17px;color:var(--primary);}
.pi-tot-row.pi-faint{color:var(--gray-400);}
.bpi-quote{border:1px solid var(--gray-200);border-radius:8px;margin-bottom:10px;overflow:hidden;}
.bpi-quote-h{background:var(--gray-50);padding:8px 12px;font-size:13px;}
.bpi-quote-h input{vertical-align:middle;margin-right:6px;}
/* derived cost-currency readout in the Build-PI modal (no longer free-text) */
.bpi-costcur-readout{padding:9px 11px;border:1px dashed var(--gray-300);border-radius:var(--radius-sm,8px);background:var(--gray-50);font-size:13px;color:var(--gray-600);min-height:38px;display:flex;align-items:center;}
.bpi-costcur-readout.is-mixed{border-color:var(--danger);color:var(--danger);background:#fef2f2;}

/* ===== Supplier quotation internal view (phase ③) ===== */
.sq-terms{display:grid;grid-template-columns:repeat(4,1fr);gap:10px 16px;margin:14px 0;}
@media(max-width:760px){.sq-terms{grid-template-columns:1fr 1fr;}}
.sq-f label{display:block;font-size:11px;color:var(--gray-500);margin-bottom:2px;}
.sq-f div{font-size:13.5px;font-weight:600;}
.sq-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px;}
.sq-card{display:flex;gap:12px;border:1px solid var(--gray-200);border-radius:10px;padding:10px;background:#fff;}
.sq-card-img{width:96px;height:96px;flex:0 0 auto;border-radius:8px;overflow:hidden;background:var(--gray-50);display:grid;place-items:center;border:1px solid var(--gray-100);}
.sq-card-img img{width:100%;height:100%;object-fit:contain;}
.sq-noimg{font-size:11px;color:var(--gray-400);}
.sq-card-body{flex:1;min-width:0;}
.sq-card-name{font-weight:700;font-size:13.5px;}
.sq-card-spec{font-size:12px;color:var(--gray-500);margin:3px 0;}
.sq-card-meta{display:flex;flex-direction:column;gap:2px;font-size:12px;margin-top:4px;}
.sq-card-remark{font-size:11.5px;color:var(--gray-600);margin-top:5px;}
.sq-reqnote{background:#FEF3E2;border:1px solid #f5d9a8;border-radius:8px;padding:9px 12px;font-size:13px;color:#b45309;margin-bottom:10px;}
.sq-bank{background:var(--gray-50);border:1px solid var(--gray-200);border-radius:8px;padding:10px 12px;font-size:12.5px;white-space:pre-wrap;font-family:inherit;}
.sq-versions{display:flex;gap:8px;flex-wrap:wrap;}
.vtag2{display:inline-block;background:var(--gray-100);border-radius:6px;font-size:11px;padding:2px 7px;color:var(--gray-600);font-weight:700;}
.pi-hint{font-size:10.5px;color:#0a7d4d;margin-top:3px;}

/* ===== Documents section (phase ④) ===== */
.pi-docs{display:flex;flex-direction:column;gap:12px;}
.doc-group{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:10px 12px;border:1px solid var(--gray-200);border-radius:10px;background:var(--gray-50);}
.doc-grp-lbl{font-size:11px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--gray-500);width:100%;margin-bottom:2px;}
.doc-btn{text-decoration:none;font-size:13px;}
.doc-warn{font-size:12.5px;color:#b45309;background:#FEF3E2;border:1px solid #f5d9a8;border-radius:8px;padding:8px 11px;margin-bottom:10px;}
/* money-risk warnings on the pricing screen (impossible target margin / negative margin) */
.pi-warn{font-size:13px;color:#b91912;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:10px 12px;margin:8px 0 12px;line-height:1.55;font-weight:500;}

/* ===== Approval workflow: stepper, confirm modal, success button (issue 6) ===== */
.btn-success{background:var(--success);color:#fff;border-color:var(--success);}
.btn-success:hover{filter:brightness(.95);}
.pi-stepper{display:flex;align-items:center;gap:0;margin:6px 0 4px;padding:14px 12px;background:#fff;border:1px solid var(--gray-200);border-radius:12px;flex-wrap:wrap;}
.pi-step{display:flex;align-items:center;gap:8px;}
.pi-step-dot{width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;background:var(--gray-100);color:var(--gray-400);border:2px solid var(--gray-200);flex:none;}
.pi-step-label{font-size:13px;color:var(--gray-400);font-weight:500;white-space:nowrap;}
.pi-step-line{flex:1;min-width:18px;height:2px;background:var(--gray-200);margin:0 8px;}
.pi-step.done .pi-step-dot{background:var(--success);border-color:var(--success);color:#fff;}
.pi-step.done .pi-step-label{color:var(--gray-600);}
.pi-step.active .pi-step-dot{background:var(--primary);border-color:var(--primary);color:#fff;box-shadow:0 0 0 4px var(--primary-light);}
.pi-step.active .pi-step-label{color:var(--primary);font-weight:700;}
.pi-stepper.is-rejected .pi-step.active .pi-step-dot{background:var(--danger);border-color:var(--danger);box-shadow:0 0 0 4px #fee2e2;}
.pi-stepper.is-rejected .pi-step.active .pi-step-label{color:var(--danger);}
.pi-step-reject{font-size:12.5px;color:var(--danger);background:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:7px 11px;margin:2px 0 6px;}
.pi-flow-help{font-size:12px;color:var(--gray-500);margin:0 0 14px;padding-left:2px;}
.confirm-body{padding:22px 24px;line-height:1.65;font-size:14px;color:var(--gray-700);}
.confirm-body p{margin:0 0 10px;}
.confirm-body ul{margin:8px 0 4px;padding-left:20px;}
.confirm-body li{margin:4px 0;}
.confirm-body b{color:var(--gray-900);}
.pi-confirm-input{width:100%;margin-top:8px;padding:9px 11px;border:1px solid var(--gray-300);border-radius:8px;font:inherit;resize:vertical;}

/* ===== Supplier contacts + catalogue note on the supplier-quote view (issue 5) ===== */
.hint-inline{font-size:11.5px;font-weight:400;color:var(--gray-400);letter-spacing:0;text-transform:none;}
.sq-contacts{display:flex;flex-wrap:wrap;gap:10px;}
.sq-contact{border:1px solid var(--gray-200);border-radius:10px;padding:10px 14px;background:var(--gray-50);min-width:200px;}
.sq-contact-name{font-weight:600;font-size:13.5px;color:var(--gray-800);}
.sq-contact-meta{font-size:12.5px;color:var(--gray-500);margin-top:3px;display:flex;gap:12px;flex-wrap:wrap;}
.sq-catalog-note{font-size:12.5px;color:var(--gray-600);background:#eef6ff;border:1px solid #cfe4ff;border-radius:8px;padding:9px 12px;margin-top:14px;}

/* Required-field validation highlight (issue: silent NOT NULL 500s) */
.field-invalid{border-color:var(--danger)!important;box-shadow:0 0 0 3px #fee2e2!important;}

/* ============================================================================
 * SINOQAT premium theme refinements (round 4) — make the internal app match
 * the polished supplier-portal aesthetic: brand black sidebar + red accent,
 * clean cards, hairlines, soft shadows, refined typography.
 * ==========================================================================*/
body{ font-family:'Jost','Inter','Segoe UI',-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",Roboto,sans-serif; -webkit-font-smoothing:antialiased; }

/* Sidebar brand wordmark */
.brand{ flex-direction:column; align-items:flex-start; gap:2px; padding:22px 22px 18px; border-bottom:1px solid rgba(255,255,255,.07); }
.brand-mark{ font-size:22px; font-weight:800; letter-spacing:3px; color:#fff; line-height:1; }
.brand-mark span{ color:var(--primary); }
.brand-sub{ font-size:9.5px; letter-spacing:.18em; color:#6B7178; text-transform:uppercase; margin-top:6px; }

/* Sidebar + nav */
.sidebar{ width:248px; }
.nav-group-title{ color:#5C636C; font-weight:600; letter-spacing:.12em; padding:0 22px 6px; }
.nav-item{ padding:9px 22px; border-left:3px solid transparent; font-size:13px; }
.nav-item:hover{ background:var(--sidebar-hover); color:#fff; }
.nav-item.active{ background:linear-gradient(90deg, rgba(226,35,26,.16), transparent); color:#fff; border-left-color:var(--primary); font-weight:600; }
.lang-btn{ border-radius:6px; }
.lang-btn.active{ background:var(--primary); }

/* Topbar */
.topbar{ padding:14px 26px; box-shadow:0 1px 0 var(--gray-200); border-bottom:none; }
.topbar h1{ font-size:18px; font-weight:700; letter-spacing:.2px; color:var(--gray-900); }
.content{ padding:26px; background:var(--gray-50); }

/* Buttons — softer radius, brand red primary */
.btn{ border-radius:var(--radius-sm); padding:9px 15px; font-weight:600; }
.btn-primary{ box-shadow:0 1px 2px rgba(226,35,26,.25); }
.btn-success{ background:var(--success); border-color:var(--success); color:#fff; }
.btn-sm{ border-radius:7px; }

/* Cards / tables / detail — white, rounded, soft shadow, hairline */
.table-wrap,.card,.detail-header,.toolbar,.kanban-board,.aging-table-wrap,.dashboard-card,.stat-card,.chart-card{
  border-radius:var(--radius)!important; border:1px solid var(--gray-200)!important; box-shadow:var(--shadow-card)!important; background:#fff;
}
.toolbar{ padding:14px 16px; }
.search-input,input,textarea,select{ border-radius:var(--radius-sm); }
input:focus,textarea:focus,select:focus,.search-input:focus{ border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); outline:none; }

.data-table thead th{ background:var(--gray-50); color:var(--gray-600); font-weight:700; font-size:11.5px; letter-spacing:.04em; text-transform:uppercase; border-bottom:1px solid var(--gray-200); }
.data-table tbody tr{ transition:background .12s; }
.data-table tbody tr:hover{ background:var(--primary-light); }
.data-table td{ border-bottom:1px solid var(--gray-100); }

/* Detail header — brand accent strip */
.detail-header{ padding:20px 22px; border-left:4px solid var(--primary)!important; }
.detail-title{ font-size:19px; font-weight:800; color:var(--gray-900); }
.detail-code{ color:var(--gray-500); letter-spacing:.04em; }

/* Section titles (PI/SQ screens) */
.pi-section-title{ font-weight:700; color:var(--gray-900); border-left:3px solid var(--primary); padding-left:10px; }

/* Tags */
.tag{ border-radius:999px; font-weight:600; font-size:11.5px; padding:3px 10px; }

/* Dashboard stat cards: red accent number */
.stat-card .stat-value,.stat-value{ color:var(--gray-900); }
.empty-state-icon{ opacity:.9; }
