/* Workspace shell — deliberately separate from Django admin's own theme
   (Unfold). Self-contained, no shared stylesheet with /admin/. */

:root {
  --ws-primary: #0d9488;
  --ws-primary-dark: #0f766e;
  --ws-bg: #f8fafc;
  --ws-border: #e2e8f0;
  --ws-text: #0f172a;
  --ws-text-muted: #64748b;
  --ws-sidebar-width: 240px;
  --ws-success: #16a34a;
  --ws-danger: #dc2626;
  --ws-warning: #d97706;
  --ws-neutral: #94a3b8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--ws-bg);
  color: var(--ws-text);
}

.ws-layout {
  display: flex;
  min-height: 100vh;
}

.ws-sidebar {
  width: var(--ws-sidebar-width);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--ws-border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
}

.ws-sidebar-brand {
  margin: -1.25rem -1rem 1.25rem;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ws-border);
}

.ws-brand-logo-row { margin-bottom: 10px; }

.ws-brand-logo {
  height: 35px;
  width: auto;
  display: block;
}

.ws-brand-tenant-label {
  font-size: 13px;
  color: var(--ws-text-muted);
  line-height: 1.4;
}

.ws-brand-tenant-name {
  font-weight: 600;
  color: var(--ws-text);
  font-size: 14px;
}

.ws-trial-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
  width: fit-content;
}

.ws-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.ws-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--ws-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.ws-nav-item:hover { background: var(--ws-bg); color: var(--ws-text); }

.ws-nav-item.active {
  background: #f0fdfa;
  color: var(--ws-primary-dark);
  font-weight: 600;
}

.ws-logout {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--ws-border);
}

.ws-logout button {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: none;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  color: var(--ws-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.ws-logout button:hover { background: var(--ws-bg); }

.ws-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ws-topbar {
  height: 60px;
  border-bottom: 1px solid var(--ws-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: #fff;
}

.ws-topbar h1 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.ws-credit-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdfa;
  color: var(--ws-primary-dark);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
}

.ws-credit-badge .ws-credit-count {
  font-size: 15px;
  font-weight: 700;
}

.ws-credit-badge i { font-size: 16px; }

.ws-credit-badge.ws-credit-low {
  background: #fffbeb;
  color: #92400e;
}

.ws-content {
  flex: 1;
  padding: 1.5rem;
}

.ws-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ws-stat-card {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.ws-stat-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.ws-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  background: #f0fdfa;
  color: var(--ws-primary-dark);
  border-radius: 8px;
  font-size: 1rem;
}

.ws-stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ws-text);
}

.ws-stat-card .label {
  font-size: 0.8rem;
  color: var(--ws-text-muted);
  font-weight: 600;
}

.ws-stat-sub { font-weight: 400; }

.ws-stat-pct {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ws-text-muted);
}

.ws-outcomes-card {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 1.25rem;
}

.ws-outcomes-header {
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
}

.ws-outcome-row {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--ws-bg);
}

.ws-outcome-row:last-child { border-bottom: none; }

.ws-outcome-row-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
}

.ws-progress-track {
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--ws-bg);
}

.ws-progress-fill {
  height: 100%;
  border-radius: inherit;
}

.ws-progress-success { background: var(--ws-success); }
.ws-progress-warning { background: var(--ws-warning); }
.ws-progress-danger  { background: var(--ws-danger); }
.ws-progress-neutral { background: var(--ws-neutral); }

.ws-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ws-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.ws-cta:hover { background: var(--ws-primary-dark); }

/* ── Executions list + detail (Sprint 3a) ─────────────────────────────── */

.ws-table-wrap {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  overflow-x: auto;
}

.ws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ws-table th, .ws-table td {
  text-align: left;
  padding: 0.65rem 1rem;
  white-space: nowrap;
}

.ws-table th {
  color: var(--ws-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--ws-border);
}

.ws-table tbody tr { border-bottom: 1px solid var(--ws-bg); }
.ws-table tbody tr:last-child { border-bottom: none; }

.ws-badge {
  display: inline-flex;
  align-items: center;
  background: #f0fdfa;
  color: var(--ws-primary-dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.ws-link {
  color: var(--ws-primary-dark);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.ws-link:hover { text-decoration: underline; }

.ws-pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--ws-text-muted);
}

.ws-pagination a {
  color: var(--ws-primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.ws-empty-state {
  background: #fff;
  border: 1px dashed var(--ws-border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  color: var(--ws-text-muted);
}

.ws-empty-state-sub { font-size: 0.85rem; margin-top: 0.25rem; }

.ws-detail-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0 1.25rem;
}

.ws-detail-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ws-text-muted);
  margin-bottom: 0.2rem;
}

.ws-tabs {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  overflow: hidden;
}

.ws-tab-buttons {
  display: flex;
  border-bottom: 1px solid var(--ws-border);
}

.ws-tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ws-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.ws-tab-btn.active {
  color: var(--ws-primary-dark);
  border-bottom-color: var(--ws-primary);
}

.ws-tab-panel { display: none; padding: 1.25rem; }
.ws-tab-panel.active { display: block; }

.ws-transcript {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}

.ws-summary-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.ws-muted { color: var(--ws-text-muted); font-size: 0.875rem; }

/* ── Demo Workflows + Run Demo (Sprint 3b) ────────────────────────────── */

.ws-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.ws-demo-card {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ws-demo-card-name { font-weight: 700; font-size: 0.95rem; }

.ws-demo-card-desc {
  color: var(--ws-text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.ws-demo-form {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1rem;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ws-form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ws-text-muted);
  margin-bottom: 0.3rem;
}

.ws-required { color: #ef4444; }

.ws-form-row input, .ws-form-row select {
  width: 100%;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
}

.ws-demo-form .ws-cta {
  border: none;
  cursor: pointer;
  align-self: flex-start;
}

/* ── Dashboard redesign (Sprint 5) ─────────────────────────────────────── */

.ws-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ws-dash-welcome {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--ws-text);
}

.ws-dash-subtitle {
  font-size: 0.85rem;
  color: var(--ws-text-muted);
  margin: 0.2rem 0 0;
}

.ws-trial-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
}

.ws-trial-banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ws-trial-banner-left i {
  font-size: 1.25rem;
  color: #b45309;
  flex-shrink: 0;
}

.ws-trial-banner-left strong {
  display: block;
  font-size: 0.875rem;
  color: #92400e;
}

.ws-trial-banner-left p {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: #a16207;
}

.ws-trial-banner-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #92400e;
  white-space: nowrap;
}

.ws-trial-banner-right i { font-size: 1.05rem; }

@media (max-width: 640px) {
  .ws-dash-header, .ws-trial-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .ws-trial-banner-right { align-self: flex-end; }
}

/* ── List filters (Executions + Conversation History) ────────────────── */

.ws-filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.ws-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ws-filter-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ws-text-muted);
}

.ws-filter-field input, .ws-filter-field select {
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  font-family: inherit;
  min-width: 160px;
}

.ws-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ws-filter-actions .ws-cta {
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
}

@media (max-width: 640px) {
  .ws-filter-bar { flex-direction: column; align-items: stretch; }
  .ws-filter-field input, .ws-filter-field select { min-width: 0; }
}

/* ── Login page ────────────────────────────────────────────────────────── */

.ws-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-login-card {
  background: #fff;
  border: 1px solid var(--ws-border);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}

.ws-login-logo {
  height: 32px;
  width: auto;
  display: block;
  margin: 0 auto 0.9rem;
}

.ws-login-subtitle {
  text-align: center;
  color: var(--ws-text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.ws-login-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.ws-login-error p { margin: 0; }
.ws-login-error p + p { margin-top: 0.3rem; }

.ws-login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ws-login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ws-text-muted);
  margin-bottom: 0.3rem;
}

.ws-login-input-wrap { position: relative; }

.ws-login-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ws-text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.ws-login-input-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.75rem 0.6rem 2.25rem;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
}

.ws-login-submit {
  width: 100%;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}
