@import url("../../theme/create-page.css");

/* Requirement Management Module CSS — Powered by theme/tokens.css */



.req-main .btn:not(.btn-primary):not([style*="background"]):not(.text-error) {
  background: rgb(var(--surface));
  color: rgb(var(--text));
  border: 1px solid rgb(var(--border));
}

.req-main .btn:not(.btn-primary):not([style*="background"]):not(.text-error):hover {
  background: rgb(var(--hover));
  border-color: rgb(var(--border));
}

.req-main .btn .ui-icon {
  fill: none;
  stroke: currentColor;
}















.req-bulk-wrap {
  position: relative;
}

.req-bulk-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 6px 20px rgb(var(--overlay) / .12);
  overflow-y: auto;
}

.req-bulk-popover .option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  text-align: left;
  padding: 7px 9px;
  border-radius: 4px;
  font-size: var(--font-body);
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

.req-bulk-popover .option .ui-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.req-bulk-popover .option:hover,
.req-bulk-popover .option:focus {
  background: rgb(var(--hover));
}

.req-bulk-popover .option.text-error,
.req-bulk-popover [data-action="bulk-remove"],
.req-bulk-popover [data-action="bulk-remove-all"] {
  color: rgb(var(--error));
}

.req-bulk-popover .option:disabled,
.req-bulk-popover .option[disabled],
.req-bulk-popover .option.text-error:disabled,
.req-bulk-popover [data-action="bulk-remove"]:disabled {
  color: rgb(var(--muted));
  opacity: .5;
  cursor: not-allowed;
  background: transparent;
}

.req-bulk-popover .option:disabled:hover,
.req-bulk-popover .option[disabled]:hover {
  background: transparent;
  color: rgb(var(--muted));
}

.req-bulk-sep {
  height: 1px;
  margin: 4px 6px;
  background: rgb(var(--border));
}

.req-more-cell {
  display: flex;
  justify-content: center;
}

.req-more-btn {
  border: 0;
  background: transparent;
  color: rgb(var(--muted));
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.req-more-btn .ui-icon {
  width: 17px;
  height: 17px;
  stroke: none;
}

.req-main .data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.data-table .col-check {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  background: rgb(var(--surface));
}

.data-table thead .col-check {
  z-index: 3;
  background: rgb(var(--hover));
}

.data-table .col-check .check {
  margin: 0 auto;
}

.data-table .col-action {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 52px;
  text-align: center;
  background: rgb(var(--surface));
}

.data-table thead .col-action {
  z-index: 3;
  background: rgb(var(--hover));
  text-align: center;
}

.req-more-btn:hover,
.req-more-btn:focus-visible,
.req-more-btn[aria-expanded="true"] {
  background: rgb(var(--hover));
  color: rgb(var(--muted));
}

.req-row-menu {
  min-width: 168px;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 6px 20px rgb(var(--overlay) / .12);
}

.req-row-menu.menu-fixed {
  position: fixed;
  z-index: 80;
}

.req-row-menu .option {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgb(var(--text));
  font: inherit;
  font-size: var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.req-row-menu .option:hover,
.req-row-menu .option:focus {
  background: rgb(var(--hover));
}

.req-row-menu .option.text-error {
  color: rgb(var(--error));
}

.req-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.req-kpi-card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.req-kpi-card:hover {
  border-color: rgb(var(--primary) / 0.4);
}

.req-kpi-card .kpi-label {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.req-kpi-card .kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 8px 0 4px;
  color: rgb(var(--text));
  line-height: 1.2;
}

.req-kpi-card .kpi-sub {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
}







.req-panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.req-toolbar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.req-toolbar .search {
  min-width: 220px;
  max-width: 380px;
  flex: 1;
}

.req-quick-select {
  min-width: 140px;
  width: 160px;
}

.req-status-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.req-pill-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface));
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.req-pill-btn:hover {
  background: rgb(var(--hover));
  color: rgb(var(--text));
}

.req-pill-btn.active {
  background: rgb(var(--primary));
  color: rgb(var(--on-primary));
  border-color: rgb(var(--primary));
}

.req-pill-count {
  padding: 1px 6px;
  border-radius: 10px;
  background: rgb(var(--border) / 0.7);
  font-size: 0.7rem;
}

.req-pill-btn.active .req-pill-count {
  background: rgb(255 255 255 / 0.25);
  color: #fff;
}

/* Badges */
.req-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: var(--font-helper);
  font-weight: 600;
  white-space: nowrap;
}

.req-badge.draft { background: rgb(var(--muted) / 0.15); color: rgb(var(--muted)); }
.req-badge.submitted, .req-badge.pendingapproval { background: rgb(var(--warning) / 0.14); color: rgb(var(--warning)); }
.req-badge.approved { background: rgb(var(--success) / 0.14); color: rgb(var(--success)); }
.req-badge.inprocurement { background: rgb(var(--info) / 0.14); color: rgb(var(--info)); }
.req-badge.partiallyfulfilled { background: rgb(var(--warning) / 0.18); color: rgb(var(--warning)); }
.req-badge.fulfilled { background: rgb(var(--success) / 0.18); color: rgb(var(--success)); }
.req-badge.closed { background: rgb(var(--secondary) / 0.12); color: rgb(var(--secondary)); }
.req-badge.rejected { background: rgb(var(--error) / 0.14); color: rgb(var(--error)); }
.req-badge.cancelled { background: rgb(var(--muted) / 0.2); color: rgb(var(--muted)); text-decoration: line-through; }

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.priority-badge.low { background: rgb(var(--muted) / 0.12); color: rgb(var(--muted)); }
.priority-badge.medium { background: rgb(var(--info) / 0.12); color: rgb(var(--info)); }
.priority-badge.high { background: rgb(var(--warning) / 0.15); color: rgb(var(--warning)); }
.priority-badge.critical { background: rgb(var(--error) / 0.15); color: rgb(var(--error)); }

/* Progress bar */
.req-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.req-progress-bar {
  flex: 1;
  height: 6px;
  background: rgb(var(--border));
  border-radius: 3px;
  overflow: hidden;
}

.req-progress-fill {
  height: 100%;
  background: rgb(var(--success));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.req-progress-fill.partial {
  background: rgb(var(--warning));
}

.req-progress-fill.empty {
  background: transparent;
}

/* Detail Page Header & Tabs */
.req-detail-head {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.req-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgb(var(--border));
  font-size: var(--font-body);
}

.req-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.req-meta-item span {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
}

.req-meta-item strong {
  color: rgb(var(--text));
  font-weight: 600;
}

.req-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid rgb(var(--border));
  margin-bottom: 20px;
  overflow-x: auto;
}

.req-tab-btn {
  padding: 10px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgb(var(--muted));
  font-size: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.req-tab-btn:hover {
  color: rgb(var(--text));
}

.req-tab-btn.active {
  color: rgb(var(--primary));
  border-bottom-color: rgb(var(--primary));
  font-weight: 600;
}

/* Timeline */
.req-timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 14px;
}

.req-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgb(var(--border));
}

.req-timeline-item {
  position: relative;
  margin-bottom: 22px;
}

.req-timeline-item:last-child {
  margin-bottom: 0;
}

.req-timeline-dot {
  position: absolute;
  left: -28px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgb(var(--surface));
  border: 2px solid rgb(var(--muted));
  display: flex;
  align-items: center;
  justify-content: center;
}

.req-timeline-item.done .req-timeline-dot {
  border-color: rgb(var(--success));
  background: rgb(var(--success) / 0.15);
  color: rgb(var(--success));
}

.req-timeline-item.active .req-timeline-dot {
  border-color: rgb(var(--primary));
  background: rgb(var(--primary) / 0.15);
  color: rgb(var(--primary));
}

.req-timeline-content {
  background: rgb(var(--canvas));
  border: 1px solid rgb(var(--border));
  border-radius: 6px;
  padding: 12px 14px;
}

.req-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 8px;
}

/* Inventory Check Callout */
.req-callout {
  padding: 14px 16px;
  border-radius: 6px;
  border-left: 4px solid rgb(var(--primary));
  background: rgb(var(--primary) / 0.06);
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.req-callout.warning {
  border-left-color: rgb(var(--warning));
  background: rgb(var(--warning) / 0.08);
}

.req-callout.success {
  border-left-color: rgb(var(--success));
  background: rgb(var(--success) / 0.08);
}

.req-callout.danger {
  border-left-color: rgb(var(--error));
  background: rgb(var(--error) / 0.08);
}

/* Dialog & Form */
.req-dialog {
  max-width: 860px;
  width: calc(100% - 32px);
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface));
}

.req-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgb(var(--border));
}

.req-dialog-body {
  padding: 20px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

.req-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgb(var(--border));
  background: rgb(var(--canvas));
}

.req-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.req-approval-section .req-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.req-approval-section .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.req-approval-section .field > admin-select {
  display: block;
  width: 100%;
  min-width: 0;
}

.req-approval-section .field > .input,
.req-approval-section admin-select > button.input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
}

.req-approval-section textarea.input {
  resize: vertical;
}

@media (max-width: 900px) {
  .req-approval-section .req-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .req-approval-section .req-form-grid { grid-template-columns: minmax(0, 1fr); }
}

.req-form-grid .full {
  grid-column: 1 / -1;
}

.req-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-table);
  margin-top: 10px;
}

.req-items-table th,
.req-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgb(var(--border));
  text-align: left;
}

.req-items-table th {
  background: rgb(var(--hover));
  color: rgb(var(--muted));
  font-weight: 600;
}

.req-items-table tbody tr:hover {
  background: rgb(var(--hover) / 0.5);
}

/* Attachments */
.req-attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid rgb(var(--border));
  border-radius: 6px;
  background: rgb(var(--canvas));
  margin-bottom: 8px;
}

.req-file-drop {
  border: 2px dashed rgb(var(--border));
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  background: rgb(var(--canvas));
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.req-file-drop:hover {
  border-color: rgb(var(--primary));
}

/* Responsive */
@media (max-width: 1024px) {
  .req-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.req-dash-layout,
.req-dash-layout > .req-panel,
.req-dash-table {
  min-width: 0;
  max-width: 100%;
}

.req-dash-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.req-queue-project {
  min-width: 0;
  overflow-wrap: anywhere;
}

.req-queue-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.req-queue-more {
  display: none;
}

.req-table-scroll,
body[data-page="approvals"] .req-panel {
  min-width: 0;
  max-width: 100%;
}

.req-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .req-queue-actions {
    display: none;
  }

  .req-queue-more {
    display: flex;
    justify-content: center;
  }

  body[data-page="approvals"] .req-action-label {
    display: none;
  }

  body[data-page="approvals"] .data-table .col-action {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
  }
}

body[data-page="dashboard"] .req-main {
  min-width: 0;
}

body[data-page="dashboard"] .req-kpi-card .kpi-label span,
body[data-page="dashboard"] .req-kpi-card .kpi-sub,
body[data-page="dashboard"] .req-panel .grid > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .req-main {
    padding: 16px;
  }
  .req-header {
    flex-direction: column;
  }
  body[data-page="dashboard"] .req-main {
    padding: 12px;
  }
  body[data-page="dashboard"] .req-header {
    align-items: stretch;
  }
  body[data-page="dashboard"] .req-actions {
    width: 100%;
  }
  body[data-page="dashboard"] .req-actions .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
  body[data-page="dashboard"] .req-panel {
    padding: 12px;
  }
  .req-kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .req-form-grid {
    grid-template-columns: 1fr;
  }
  .req-meta-row {
    flex-direction: column;
    gap: 10px;
  }
}
.req-panel > .overflow-x-auto {
  position: relative;
  z-index: 1;
}
.req-advanced-filters { position: relative; z-index: 6; }
.req-advanced-filters .btn-text {
  border: 0; background: transparent; color: rgb(var(--primary)); padding: 6px 4px;
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.req-advanced-filters .btn-text:hover { text-decoration: underline; }
.req-advanced-filters .adv-filter-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: min(560px, calc(100vw - 32px)); box-sizing: border-box;
  background: rgb(var(--surface)); border: 1px solid rgb(var(--border));
  border-radius: 8px; padding: 14px; box-shadow: 0 10px 28px rgb(var(--overlay)/.14);
}
.req-advanced-filters .adv-filter-rows { display: flex; flex-direction: column; gap: 10px; }
.req-advanced-filters .adv-filter-row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 36px;
  gap: 8px; align-items: center;
}
.req-advanced-filters .adv-filter-row > div { min-width: 0; }
.req-advanced-filters admin-select { display: block; width: 100%; }
.req-advanced-filters .input { width: 100%; min-height: 40px; }
.req-advanced-filters .adv-filter-row .icon-btn { color: rgb(var(--muted)); justify-self: center; }
.req-advanced-filters .adv-filter-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid rgb(var(--border)); flex-wrap: wrap;
}
.req-advanced-filters .adv-filter-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
@media (max-width: 760px) {
  .req-toolbar:has(.req-advanced-filters) { position: relative; }
  .req-advanced-filters { position: static; }
  .req-advanced-filters .adv-filter-panel { left: 0; right: 0; width: 100%; }
  .req-advanced-filters .adv-filter-row { grid-template-columns: 1fr; }
  .req-advanced-filters .adv-filter-row .icon-btn { justify-self: end; }
  .req-advanced-filters .adv-filter-actions { margin-left: 0; width: 100%; }
  .req-advanced-filters .adv-filter-actions .btn { flex: 1; }
}
.req-comments { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid rgb(var(--border)); }
.req-comments h2 { font-size: var(--font-section); font-weight: 600; margin-bottom: .5rem; }
.req-comments form { margin-top: 1rem; }
.req-comments .req-comment-compose { display: flex; align-items: flex-start; gap: .75rem; }
.req-comments .req-comment-avatar { flex: 0 0 2rem; text-align: center; padding-top: .75rem; color: rgb(var(--primary)); }
.req-comments .req-comment-list { list-style: none; padding: 0; margin: 1rem 0; }
.req-comments .req-comment { padding: 1rem 0; border-bottom: 1px solid rgb(var(--border)); }
.req-comments .req-comment-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; overflow-wrap: anywhere; }
.req-comments .req-comment-meta span,
.req-comments .req-comment-meta time { color: rgb(var(--muted)); }
.req-comments .req-comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .5rem; }
.req-comments textarea { display: block; width: 100%; min-width: 0; min-height: 3rem; resize: vertical; background: rgb(var(--hover)); }
.req-comments #req-comment-error { color: rgb(var(--error)); margin: .5rem 0; }

.data-table tr.req-row-link { cursor: pointer; }
