/* ============================================================
   Whisper Analysis App — Dark Terminal Theme
   Design spec: Pencil canonical
   ============================================================ */

:root {
  /* Backgrounds */
  --bg-base:       #0C0C0C;
  --bg-surface:    #171717;
  --bg-raised:     #1A1A1A;
  --bg-modal:      #171717;

  /* Borders */
  --border:        #1F1F1F;
  --border-subtle: #252525;

  /* Text */
  --text-primary:  #E5E5E5;
  --text-secondary:#A3A3A3;
  --text-muted:    #737373;
  --text-dim:      #525252;

  /* Status / Accent */
  --green:         #22C55E;
  --amber:         #F59E0B;
  --red:           #EF4444;
  --blue:          #3B82F6;

  /* Misc */
  --avatar-bg:     #1F1F1F;
  --avatar-text:   #737373;

  /* Sizing */
  --sidebar-width: 240px;
  --radius-sm:     4px;
  --radius:        4px;

  /* Transitions */
  --transition: 150ms ease;
}

/* ---- Reset ---- */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--green); text-decoration: none; }
a:hover { opacity: 0.85; }

input, button, textarea, select {
  font-family: 'JetBrains Mono', monospace;
}

/* ---- App Shell ---- */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.app-wrapper.login-mode .sidebar { display: none; }
.app-wrapper.login-mode .main-content { margin-left: 0; }

/* ---- Sidebar ---- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 32px 20px 16px 20px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
}

.sidebar-logo .logo-tilde {
  color: var(--green);
}

.sidebar-logo .logo-text {
  color: var(--text-primary);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 37px;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  white-space: nowrap;
}

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

.nav-item.active {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.nav-item .nav-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}

.nav-item.active .nav-icon {
  color: var(--text-primary);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0 20px 32px 20px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--avatar-bg);
  color: var(--avatar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 11px;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.btn-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  transition: color var(--transition);
  display: none;
}

.btn-logout:hover {
  color: var(--red);
}

/* ---- Main Content ---- */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Page header bar */
.page-header {
  height: 80px;
  min-height: 80px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.page-header-left h2 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header-left .page-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Content area */
.page-content {
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  flex: 1;
}

/* ---- Cards ---- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.card-header .card-count {
  font-size: 12px;
  color: var(--text-dim);
}

.card-header .card-badge {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}

.card-header .card-link {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  cursor: pointer;
}

.card-header .card-link:hover {
  opacity: 0.8;
}

.card-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0;
}

/* ---- Stat Cards ---- */

.stats-row {
  display: flex;
  gap: 16px;
}

.stat-card {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.75; }

.btn-primary {
  background: var(--green);
  color: var(--bg-base);
}

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: none;
}

.btn-danger {
  background: var(--bg-raised);
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-danger-solid {
  background: var(--red);
  color: #fff;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.btn-icon {
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 12px;
  transition: color var(--transition);
}

.btn-icon:hover {
  color: var(--red);
}

.btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: lowercase;
}

.form-input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--green);
}

.form-input::placeholder {
  color: var(--text-muted);
}

textarea.form-input {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

.form-check input[type="checkbox"] {
  accent-color: var(--green);
  width: 14px;
  height: 14px;
}

/* ---- Filter pills ---- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

.filter-pill {
  height: 27px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  border: none;
  background: var(--bg-raised);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  display: inline-flex;
  align-items: center;
}

.filter-pill.active {
  background: var(--green);
  color: var(--bg-base);
}

/* ---- Tables ---- */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: 10px 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

table td {
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table tbody tr {
  transition: background var(--transition);
}

table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

table tbody tr.clickable {
  cursor: pointer;
}

/* Table cell widths for tasks */
.col-task-id { width: 200px; }
.col-status { width: 110px; }
.col-stage { width: 120px; }
.col-file { }
.col-created { width: 140px; }
.col-actions { width: 160px; }

/* ---- Status text (plain, not badges) ---- */

.status-completed { color: var(--green); font-weight: 500; }
.status-processing { color: var(--amber); font-weight: 500; }
.status-failed { color: var(--red); font-weight: 500; }
.status-pending { color: var(--text-muted); font-weight: 500; }
.status-awaiting { color: var(--amber); font-weight: 500; }
.status-cancelled { color: var(--text-muted); font-weight: 500; }

/* ---- Method badges (API docs) ---- */

.method-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--bg-base);
  flex-shrink: 0;
}

.method-get { background: var(--green); }
.method-post { background: var(--blue); }
.method-delete { background: var(--red); }

/* ---- Pipeline stages ---- */

.pipeline-stages {
  display: flex;
  gap: 8px;
}

.pipeline-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.pipeline-stage .stage-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.pipeline-stage.stage-completed .stage-bar {
  background: var(--green);
}

.pipeline-stage.stage-active .stage-bar {
  background: var(--amber);
}

.pipeline-stage.stage-failed .stage-bar {
  background: var(--red);
}

.pipeline-stage .stage-label {
  font-size: 11px;
  color: var(--text-muted);
}

.pipeline-stage.stage-active .stage-label {
  color: var(--amber);
}

.pipeline-stage.stage-completed .stage-label {
  color: var(--green);
}

/* ---- Meta bar (task detail) ---- */

.meta-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  display: flex;
  overflow: hidden;
}

.meta-bar-cell {
  padding: 12px 20px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-bar-cell:last-child {
  border-right: none;
}

.meta-bar-cell .meta-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: lowercase;
}

.meta-bar-cell .meta-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.meta-bar-cell .meta-value.color-amber {
  color: var(--amber);
}

.meta-bar-cell .meta-value.color-green {
  color: var(--green);
}

/* ---- Breadcrumb ---- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.breadcrumb a {
  color: var(--text-dim);
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb .breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ---- Tabs ---- */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.tab-item {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'JetBrains Mono', monospace;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* ---- Transcript block ---- */

.transcript-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 12px;
  line-height: 1.7;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.transcript-block .speaker {
  color: var(--green);
  font-weight: 600;
}

.transcript-block.transcript-editable {
  padding: 6px 8px;
  line-height: 1.25;
  white-space: normal;
}

.transcript-block.transcript-editable .transcript-segment {
  margin: 0;
}

/* ---- Analysis results ---- */

.analysis-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-item {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.analysis-item-header {
  padding: 12px 16px;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition);
}

.analysis-item-header:hover {
  background: var(--bg-surface);
}

.analysis-item-body {
  padding: 0 16px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ---- Two-column layout ---- */

.two-col {
  display: flex;
  gap: 20px;
}

.two-col .col-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.two-col .col-side {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Dashboard bottom row */
.dash-bottom {
  display: flex;
  gap: 16px;
  flex: 1;
}

.dash-bottom .dash-left {
  width: 360px;
  flex-shrink: 0;
}

.dash-bottom .dash-right {
  flex: 1;
}

/* ---- Webhook row in dashboard ---- */

.webhook-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 12px;
}

.webhook-row .webhook-url {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webhook-row .webhook-status {
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
}

/* ---- Endpoint row (API docs) ---- */

.endpoint-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.endpoint-path {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.endpoint-desc {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---- Base URL bar ---- */

.base-url-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  height: 40px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.base-url-bar .url-label {
  font-size: 12px;
  color: var(--text-dim);
}

.base-url-bar .url-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ---- Login Page ---- */

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-base);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.login-card h2 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
}

.login-card .login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 28px;
}

.login-card .btn-primary {
  width: 100%;
  height: 36px;
  font-size: 12px;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 16px;
  display: none;
}

.login-error.visible {
  display: block;
}

/* ---- Spinner ---- */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

/* ---- Toast notifications ---- */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 12px;
  color: var(--text-primary);
  animation: toast-in 250ms ease forwards;
  max-width: 360px;
}

.toast.toast-error {
  border-left: 3px solid var(--red);
}

.toast.toast-success {
  border-left: 3px solid var(--green);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Upload area ---- */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: border-color var(--transition), background var(--transition);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.05);
}

.upload-area .upload-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

/* ---- Speaker mapping ---- */

.speaker-map-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.speaker-map-row .speaker-original {
  font-weight: 500;
  color: var(--green);
  min-width: 120px;
  font-size: 12px;
}

.speaker-map-row .arrow {
  color: var(--text-muted);
  font-size: 12px;
}

.speaker-map-row .form-input {
  flex: 1;
}

/* ---- Empty State ---- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-state .empty-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

/* ---- Responsive ---- */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .page-header {
    padding: 0 20px;
    height: 64px;
  }

  .page-content {
    padding: 20px;
  }

  .stats-row {
    flex-wrap: wrap;
  }

  .stat-card {
    min-width: calc(50% - 8px);
  }

  .two-col {
    flex-direction: column;
  }

  .two-col .col-side {
    width: 100%;
  }

  .dash-bottom {
    flex-direction: column;
  }

  .dash-bottom .dash-left {
    width: 100%;
  }

  .meta-bar {
    flex-wrap: wrap;
  }
}

/* ---- Utility ---- */

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-green { color: var(--green); }
.mt-4 { margin-top: 16px; }
.mt-2 { margin-top: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 8px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Analysis status dots */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.dot-green { background: var(--green); }
.status-dot.dot-amber { background: var(--amber); }
.status-dot.dot-red { background: var(--red); }
.status-dot.dot-muted { background: var(--text-muted); }

/* Profile 2-col layout */
.profile-layout {
  display: flex;
  gap: 20px;
}

.profile-layout .profile-main {
  flex: 1;
}

.profile-layout .profile-side {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 1024px) {
  .profile-layout {
    flex-direction: column;
  }
  .profile-layout .profile-side {
    width: 100%;
  }
}

/* Inline add-webhook row */
.add-webhook-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.add-webhook-bar .add-label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.add-webhook-bar .form-input {
  flex: 1;
}

/* Usage stat rows */
.usage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
}

.usage-row .usage-label {
  color: var(--text-muted);
}

.usage-row .usage-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Detail grid for task detail */
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 12px;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 400;
}

.detail-value {
  color: var(--text-primary);
  word-break: break-word;
}

/* Search bar for transcript */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-bar .form-input {
  flex: 1;
}

.search-bar .line-count {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---- Sortable table headers ---- */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
th.sortable:hover {
  color: var(--text-primary);
}
