.sp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.sp-page-header-text h1 {
  font-size: 1.55rem;
  margin: 0 0 6px;
  color: var(--color-secondary);
}

.sp-page-header-text p {
  margin: 0;
  color: var(--color-text-light);
}

.sp-page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sp-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.sp-toolbar {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.sp-toolbar-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sp-toolbar-right {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.sp-search-box {
  min-width: 260px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: #fff;
}

.sp-search-box input {
  border: none;
  outline: none;
  min-height: 36px;
  width: 100%;
  font: inherit;
  color: var(--color-text);
}

.sp-search-box svg {
  color: var(--color-text-muted);
}

.sp-filter-select {
  min-height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  font: inherit;
  padding: 0 10px;
}

.sp-results-count {
  color: var(--color-text-muted);
  font-size: 0.84rem;
}

.sp-table-wrap {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: auto;
}

.sp-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.sp-table th,
.sp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-table th {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: 0.73rem;
  text-transform: uppercase;
  position: relative;
  user-select: none;
  overflow: visible;
}

.sp-table tr:hover td {
  background: #fafbff;
}

.sp-empty {
  padding: 24px;
  color: var(--color-text-muted);
  text-align: center;
}

.sp-priority,
.sp-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
}

.sp-priority-urgent { background: #fee2e2; color: #b91c1c; }
.sp-priority-high { background: #ffedd5; color: #c2410c; }
.sp-priority-medium { background: #fef3c7; color: #a16207; }
.sp-priority-low { background: #dcfce7; color: #166534; }

.sp-status-new { background: #e0e7ff; color: #3730a3; }
.sp-status-open { background: #dbeafe; color: #1d4ed8; }
.sp-status-in-progress { background: #fef3c7; color: #a16207; }
.sp-status-waiting-for-user { background: #ffedd5; color: #9a3412; }
.sp-status-resolved { background: #dcfce7; color: #166534; }
.sp-status-closed { background: #e5e7eb; color: #334155; }
.sp-status-archived { background: #f1f5f9; color: #475569; }
.stat-icon-secondary { background: #e2e8f0; color: #334155; }

.sp-th-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 10px);
}

.sp-th-label {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  font-size: inherit;
  text-transform: inherit;
  padding: 0;
  cursor: pointer;
  letter-spacing: inherit;
}

.sp-th-label[disabled] {
  cursor: default;
}

.sp-th-sort {
  color: var(--color-primary);
  font-size: 0.7rem;
}

.sp-th-drag {
  cursor: move;
}

.sp-col-resize {
  position: absolute;
  top: 0;
  right: -4px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
  background: linear-gradient(to right, transparent 0, transparent 5px, rgba(148, 163, 184, 0.45) 5px, rgba(148, 163, 184, 0.45) 6px, transparent 6px);
}

.sp-drag-over-left {
  box-shadow: inset 2px 0 0 var(--color-primary);
}

.sp-drag-over-right {
  box-shadow: inset -2px 0 0 var(--color-primary);
}

.sp-row-actions {
  display: flex;
  gap: 6px;
}

.sp-inline-assign,
.sp-inline-select {
  min-width: 150px;
  max-width: 220px;
  min-height: 30px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  font: inherit;
  font-size: 0.78rem;
  padding: 0 8px;
}

.sp-inline-assign:disabled,
.sp-inline-select:disabled {
  background: #f8fafc;
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.sp-consumed-time {
  white-space: nowrap;
  font-weight: 600;
}

.sp-icon-btn {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text-light);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sp-icon-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.sp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 2000;
}

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

.sp-modal {
  width: min(100%, 920px);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.sp-modal-lg {
  width: min(100%, 1040px);
}

.sp-modal-header,
.sp-modal-footer {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sp-modal-footer {
  border-top: 1px solid var(--color-border);
  border-bottom: none;
  justify-content: flex-end;
}

.sp-modal-header h2 {
  font-size: 1.02rem;
  margin: 0;
}

.sp-modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
}

.sp-modal-body {
  padding: 16px;
  overflow: auto;
}

.sp-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.sp-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-bottom: 12px;
}

.sp-detail-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: #fff;
}

.sp-detail-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-bottom: 3px;
}

.sp-timeline {
  margin-top: 10px;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.sp-timeline-item {
  border-left: 2px solid var(--color-border);
  padding: 0 0 12px 10px;
  margin-left: 6px;
}

.sp-comment-box {
  margin-top: 14px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.sp-comment-box textarea {
  width: 100%;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
}

@media (max-width: 1100px) {
  .sp-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .sp-page-header {
    flex-direction: column;
  }

  .sp-form-grid,
  .sp-detail-grid {
    grid-template-columns: 1fr;
  }

  .sp-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .sp-stats-grid {
    grid-template-columns: 1fr;
  }
}
