/* SCOP — TPS Geçmişi workspace */

.tps-hist-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-5) var(--space-5);
  min-height: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.tps-hist-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.tps-hist-breadcrumb {
  margin: 0;
  font-size: var(--fs-12);
  line-height: 1.2;
  color: var(--text-secondary, #64748b);
}

.tps-hist-breadcrumb span {
  margin: 0 var(--space-1);
  opacity: 0.7;
}

.tps-hist-heading h1 {
  margin: var(--space-0-5) 0 0;
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  color: var(--text-primary, #0f172a);
}

.tps-hist-heading p {
  margin: var(--space-0-5) 0 0;
  color: var(--text-secondary, #64748b);
  font-size: var(--fs-13);
  line-height: 1.3;
  max-width: 42rem;
}

.tps-hist-header-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.tps-hist-stub-btn,
.tps-hist-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
}

.tps-hist-stub-btn svg,
.tps-hist-filter-btn svg,
.tps-hist-eye svg,
.tps-hist-info svg,
.tps-hist-search-icon svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.tps-hist-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tps-hist-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.tps-hist-select {
  min-height: 2.4rem;
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  color: var(--text-primary, #0f172a);
  font-size: var(--fs-14);
  min-width: 0;
  flex: 1 1 10rem;
}

.tps-hist-date-btn {
  flex: 1 1 14rem;
  justify-content: flex-start;
  min-width: 0;
  min-height: 2.4rem;
  text-align: left;
}

.tps-hist-search-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
}

.tps-hist-search-icon {
  color: var(--color-text-muted);
  display: inline-flex;
}

.tps-hist-search {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--fs-14);
  color: var(--text-primary, #0f172a);
  min-width: 0;
}

.tps-hist-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  gap: var(--space-3);
  align-items: start;
  min-width: 0;
}

@media (max-width: 1280px) {
  .tps-hist-main {
    grid-template-columns: 1fr;
  }
}

.tps-hist-list-card,
.tps-hist-panel {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(12, 18, 32, 0.04);
  min-width: 0;
}

.tps-hist-list-head,
.tps-hist-panel {
  padding: var(--space-4) var(--space-4);
}

.tps-hist-list-head h2,
.tps-hist-panel h3 {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--text-primary, #0f172a);
}

.tps-hist-table-wrap {
  overflow: hidden;
  border-top: 1px solid var(--border-subtle, var(--color-border-light));
  min-width: 0;
}

.tps-hist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--fs-13);
}

.tps-hist-table th,
.tps-hist-table td {
  padding: var(--space-2) var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
  overflow: hidden;
}

.tps-hist-table th {
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
  white-space: normal;
  line-height: 1.25;
}

.tps-hist-table tbody tr:hover td {
  background: var(--color-surface-muted);
}

.tps-hist-table th:nth-child(1),
.tps-hist-table td:nth-child(1) {
  width: 12%;
}

.tps-hist-table th:nth-child(2),
.tps-hist-table td:nth-child(2) {
  width: 12%;
}

.tps-hist-table th:nth-child(3),
.tps-hist-table td:nth-child(3) {
  width: 20%;
}

.tps-hist-table th:nth-child(4),
.tps-hist-table td:nth-child(4) {
  width: 20%;
}

.tps-hist-table th:nth-child(5),
.tps-hist-table td:nth-child(5) {
  width: 14%;
}

.tps-hist-table th:nth-child(6),
.tps-hist-table td:nth-child(6) {
  width: 14%;
}

.tps-hist-table th:nth-child(7),
.tps-hist-table td:nth-child(7) {
  width: 8%;
}

.tps-hist-datetime,
.tps-hist-inst,
.tps-hist-ref {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.tps-hist-date,
.tps-hist-inst-name,
.tps-hist-tps-no {
  font-weight: var(--fw-semibold);
  color: var(--text-primary, #0f172a);
  line-height: 1.25;
}

.tps-hist-time,
.tps-hist-inst-doc,
.tps-hist-ref-no {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  line-height: 1.25;
}

.tps-hist-inst-name,
.tps-hist-inst-doc,
.tps-hist-tps-no,
.tps-hist-ref-no,
.tps-hist-file,
.tps-hist-table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tps-hist-empty-cell {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-8) var(--space-4) !important;
}

.tps-hist-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: var(--space-0-5) var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tps-hist-badge--success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.tps-hist-badge--danger {
  background: var(--color-danger-bg);
  color: var(--color-pink-text);
}

.tps-hist-badge--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.tps-hist-badge--info {
  background: var(--color-info-bg);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
}

.tps-hist-badge--muted {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

.tps-hist-actions-cell {
  text-align: center;
}

.tps-hist-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-info-bg);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
  cursor: pointer;
}

.tps-hist-eye:hover {
  background: var(--color-info-bg);
}

@media (max-width: 900px) {
  .tps-hist-table thead {
    display: none;
  }

  .tps-hist-table,
  .tps-hist-table tbody,
  .tps-hist-table tr,
  .tps-hist-table td {
    display: block;
    width: 100% !important;
  }

  .tps-hist-table tbody {
    padding: var(--space-2);
  }

  .tps-hist-table tr.tps-hist-row {
    margin-bottom: var(--space-3);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow: hidden;
  }

  .tps-hist-table tbody tr:hover td {
    background: transparent;
  }

  .tps-hist-table td {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-light);
  }

  .tps-hist-table td:last-child {
    border-bottom: none;
  }

  .tps-hist-table td::before {
    content: attr(data-label);
    font-size: var(--fs-12);
    font-weight: var(--fw-semibold);
    color: var(--color-text-muted);
  }

  .tps-hist-actions-cell {
    text-align: left;
  }

  .tps-hist-inst-name,
  .tps-hist-inst-doc,
  .tps-hist-tps-no,
  .tps-hist-ref-no,
  .tps-hist-file,
  .tps-hist-table td:nth-child(2) {
    white-space: normal;
  }
}

.tps-hist-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.tps-hist-page-meta {
  font-size: var(--fs-13);
  color: var(--color-text-muted);
}

.tps-hist-page-btns {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.tps-hist-page-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--fs-13);
  cursor: pointer;
}

.tps-hist-page-btn.is-active {
  background: var(--color-action-primary);
  border-color: var(--color-brand-primary);
  color: #fff;
  font-weight: var(--fw-semibold);
}

.tps-hist-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tps-hist-page-ellipsis {
  color: var(--color-text-muted);
  padding: 0 var(--space-1);
}

.tps-hist-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tps-hist-placeholder {
  margin-top: var(--space-3);
  min-height: 140px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--fs-13);
}

.tps-hist-placeholder p {
  margin: 0;
}

.tps-hist-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.tps-hist-bar-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-1);
}

.tps-hist-bar-label {
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
}

.tps-hist-bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  overflow: hidden;
}

.tps-hist-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-action-primary);
}

.tps-hist-bar-meta {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
}

.tps-hist-avg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.tps-hist-avg-cell {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  border: 1px solid light-dark(#eef2f7, var(--color-info-border));
  text-align: center;
}

.tps-hist-avg-label {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
}

.tps-hist-avg-value {
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.tps-hist-avg-delta {
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
}

.tps-hist-avg-delta--down {
  color: var(--color-success-text);
}

.tps-hist-avg-delta--up {
  color: var(--color-danger-text);
}

.tps-hist-avg-delta--flat {
  color: var(--color-text-muted);
}

.tps-hist-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.tps-hist-info {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-info-bg);
  color: light-dark(var(--color-brand-deep), var(--color-info-text));
  font-size: var(--fs-13);
  border: 1px solid var(--color-info-border);
}

.tps-hist-row {
  cursor: pointer;
}

.tps-hist-row:focus {
  outline: 2px solid var(--color-info-border);
  outline-offset: -2px;
}

/* —— İş akışı detay —— */

.tps-flow-workspace {
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6) var(--space-8);
  min-width: 0;
  overflow-x: hidden;
}

.tps-flow-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.tps-flow-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}

.tps-flow-close:hover {
  background: var(--color-surface-muted);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.tps-flow-close svg {
  width: 1rem;
  height: 1rem;
}

.tps-flow-stepper {
  list-style: none;
  margin: 0;
  padding: var(--space-6) var(--space-4) var(--space-6);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  background: var(--color-surface);
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 7.25rem;
}

.tps-flow-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
  padding: 0 var(--space-1-5);
}

.tps-flow-step:not(:first-child)::before,
.tps-flow-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.15rem;
  height: 2px;
  background: var(--color-surface-muted);
  pointer-events: none;
}

.tps-flow-step:not(:first-child)::before {
  left: 0;
  right: calc(50% + 1.3rem);
}

.tps-flow-step:not(:last-child)::after {
  left: calc(50% + 1.3rem);
  right: 0;
}

.tps-flow-step--completed:not(:last-child)::after,
.tps-flow-step--completed:not(:first-child)::before,
.tps-flow-step--current:not(:first-child)::before {
  background: light-dark(#86efac, var(--color-success-bg));
}

.tps-flow-step-node {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  border: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-muted);
  z-index: 1;
  flex-shrink: 0;
}

.tps-flow-step-node svg {
  width: 1rem;
  height: 1rem;
}

.tps-flow-step--completed .tps-flow-step-node {
  background: #16a34a;
  border-color: light-dark(#16a34a, var(--color-success-border));
  color: #fff;
}

.tps-flow-step--current .tps-flow-step-node {
  background: var(--color-action-primary);
  border-color: var(--color-brand-primary);
  color: #fff;
}

.tps-flow-step-body {
  min-width: 0;
  width: 100%;
}

.tps-flow-step-title {
  margin-top: var(--space-3);
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tps-flow-step-meta {
  margin-top: var(--space-1);
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .tps-flow-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-1-5);
  }

  .tps-flow-step::before,
  .tps-flow-step::after {
    display: none;
  }
}

.tps-flow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

@media (max-width: 1100px) {
  .tps-flow-grid {
    grid-template-columns: 1fr;
  }
}

.tps-flow-card {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle, var(--color-border-light));
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(12, 18, 32, 0.04);
  padding: var(--space-4) var(--space-5) var(--space-5);
  min-width: 0;
}

.tps-flow-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.tps-flow-card-head h2 {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.tps-flow-card-icon {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: var(--radius-sm);
  background: var(--color-info-bg);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tps-flow-card-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

.tps-flow-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-8);
}

@media (max-width: 700px) {
  .tps-flow-kv-grid {
    grid-template-columns: 1fr;
  }
}

.tps-flow-kv-col {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tps-flow-field dt {
  margin: 0;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  font-weight: var(--fw-semibold);
}

.tps-flow-field dd {
  margin: var(--space-0-5) 0 0;
  font-size: var(--fs-13);
  color: var(--color-text-primary);
  line-height: 1.35;
}

.tps-flow-strong {
  font-weight: var(--fw-semibold);
}

.tps-flow-sub {
  display: block;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  margin-top: var(--space-0-5);
}

.tps-flow-copy-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-0-5);
  position: relative;
  padding-right: var(--space-6);
}

.tps-flow-copy-wrap .tps-flow-icon-btn {
  position: absolute;
  top: 0;
  right: 0;
}

.tps-flow-link {
  border: none;
  background: none;
  padding: 0;
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
  font: inherit;
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

.tps-flow-link:hover {
  text-decoration: underline;
}

.tps-flow-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.tps-flow-icon-btn:hover {
  background: var(--color-surface-muted);
  color: light-dark(var(--color-brand-hover), var(--color-cyan-text));
}

.tps-flow-icon-btn svg {
  width: 0.9rem;
  height: 0.9rem;
}

.tps-flow-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tps-flow-tl-item {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
}

.tps-flow-tl-item:last-child {
  border-bottom: none;
}

.tps-flow-tl-dot {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-muted);
  color: #fff;
  margin-top: var(--space-0-5);
}

.tps-flow-tl-dot svg {
  width: 0.75rem;
  height: 0.75rem;
}

.tps-flow-tl-item--completed .tps-flow-tl-dot {
  background: #16a34a;
}

.tps-flow-tl-item--current .tps-flow-tl-dot {
  background: var(--color-action-primary);
}

.tps-flow-tl-title {
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.tps-flow-tl-desc {
  margin-top: var(--space-0-5);
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  line-height: 1.35;
}

.tps-flow-tl-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-0-5);
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.tps-flow-doc-table-wrap {
  overflow: hidden;
  min-width: 0;
}

.tps-flow-doc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--fs-13);
}

.tps-flow-doc-table th,
.tps-flow-doc-table td {
  padding: var(--space-2) var(--space-1-5);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.tps-flow-doc-table th {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  font-weight: var(--fw-semibold);
}

.tps-flow-doc-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  min-width: 0;
  max-width: 100%;
}

.tps-flow-doc-icon {
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
}

.tps-flow-doc-icon svg {
  width: 1.4rem;
  height: 1.4rem;
}

.tps-flow-doc-actions {
  white-space: nowrap;
}

.tps-flow-doc-footer {
  margin-top: var(--space-3);
}

.tps-flow-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: light-dark(var(--color-brand-deep), var(--color-info-text));
  font-size: var(--fs-13);
  line-height: 1.4;
}

.tps-flow-banner svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  margin-top: var(--space-0-5);
}

