.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-soft);
}

.surface--panel {
  padding: var(--space-6);
  box-shadow: var(--shadow-panel);
}

.surface--soft {
  background: var(--color-surface-soft);
  box-shadow: none;
}

.workspace-card {
  display: grid;
  gap: var(--space-5);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.section-header h1,
.section-header h2,
.section-header p {
  margin-block-end: 0;
}

.section-eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-block-end: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-micro);
  font-weight: 650;
  line-height: 1.2;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  width: fit-content;
  max-width: 100%;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-control);
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--color-divider);
}

.toolbar-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  line-height: 1.15;
  transition: background 160ms var(--ease-soft), color 160ms var(--ease-soft), box-shadow 160ms var(--ease-soft), transform 160ms var(--ease-press);
}

.toolbar-item:hover,
.toolbar-item.is-active {
  color: var(--color-text);
  background: var(--color-surface-soft);
  box-shadow: var(--shadow-control);
}

.toolbar-item:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-control-pressed);
}

.button-pill,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: var(--space-2);
  border: 1px solid var(--color-border-soft);
  transition: transform 160ms var(--ease-press), box-shadow 160ms var(--ease-soft), background 160ms var(--ease-soft), color 160ms var(--ease-soft), border-color 160ms var(--ease-soft);
}

.button-pill {
  min-width: 44px;
  padding: 0 var(--space-5);
  color: var(--color-text);
  background: var(--color-surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-control);
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}

.button-pill:hover,
.icon-button:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

.button-pill:active,
.icon-button:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-control-pressed);
}

.button-pill--primary {
  color: var(--color-text);
  background: var(--color-surface);
}

.button-pill--secondary {
  color: var(--color-blue);
  background: var(--color-blue-soft);
}

.button-pill--ghost {
  color: var(--color-text-soft);
  background: transparent;
  box-shadow: none;
}

.button-pill--danger {
  color: var(--color-red);
  background: var(--color-red-soft);
}

.button-pill--ai {
  color: var(--color-text-on-accent);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.55), transparent 28%),
    linear-gradient(135deg, var(--color-ai-pink), var(--color-ai-peach) 48%, var(--color-ai-blue));
  border-color: transparent;
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--color-text-soft);
  background: var(--color-surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-control);
}

.icon-button--danger:hover {
  color: var(--color-red);
  background: var(--color-red-soft);
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
}

.segment {
  min-height: 44px;
  padding: 0 var(--space-4);
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  font-weight: 600;
  line-height: 1.1;
}

.segment[aria-selected="true"] {
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  gap: var(--space-2);
  width: fit-content;
  padding: var(--space-1) var(--space-3);
  border: 1px solid color-mix(in srgb, currentColor, transparent 78%);
  border-radius: var(--radius-pill);
  font-size: var(--text-small);
  font-weight: 650;
  line-height: 1.15;
}

.status-chip svg {
  width: 0.9em;
  height: 0.9em;
}

.status-chip--pending {
  color: color-mix(in srgb, var(--color-yellow), var(--color-text) 35%);
  background: var(--color-yellow-soft);
}

.status-chip--submitted,
.status-chip--billable {
  color: var(--color-blue);
  background: var(--color-blue-soft);
}

.status-chip--approved,
.status-chip--completed {
  color: color-mix(in srgb, var(--color-green), var(--color-text) 35%);
  background: var(--color-green-soft);
}

.status-chip--rejected,
.status-chip--failed {
  color: var(--color-red);
  background: var(--color-red-soft);
}

.status-chip--neutral,
.status-chip--non-billable {
  color: var(--color-grey-status);
  background: var(--color-grey-status-soft);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field label,
.field-label {
  color: var(--color-text-soft);
  font-size: var(--text-small);
  font-weight: 650;
  line-height: 1.2;
}

.field-control {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-4);
  color: var(--color-text);
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-surface) 70%, transparent);
}

textarea.field-control {
  min-height: 112px;
  padding-block: var(--space-3);
  resize: vertical;
}

.field-control::placeholder {
  color: var(--color-text-muted);
}

.field-control:focus {
  border-color: var(--color-blue);
}

.field-control[aria-invalid="true"] {
  color: var(--color-red);
  border-color: var(--color-red);
}

.field-helper {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-micro);
}

.field-error {
  margin: 0;
  color: var(--color-red);
  font-size: var(--text-micro);
  font-weight: 600;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  color: var(--color-text-soft);
  font-weight: 600;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  position: relative;
  width: 58px;
  height: 34px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 2px 8px color-mix(in srgb, var(--color-text) 12%, transparent);
  transition: background 160ms var(--ease-soft);
}

.toggle-track::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  content: "";
  background: var(--color-surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-control);
  transition: transform 180ms var(--ease-soft);
}

.toggle input:checked + .toggle-track {
  background: var(--color-blue-soft);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(24px);
}

.toggle input:focus-visible + .toggle-track {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.metric-tile {
  display: grid;
  gap: var(--space-2);
  min-height: 132px;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.metric-tile--accent {
  background: linear-gradient(180deg, var(--color-yellow-soft), var(--color-surface));
}

.metric-value {
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  font-weight: 650;
  line-height: 1;
}

.metric-label {
  color: var(--color-text-muted);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.25;
}

.metric-note {
  margin: 0;
  color: var(--color-text-soft);
  font-size: var(--text-micro);
}

.secondary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.secondary-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  gap: var(--space-1);
  padding: 0 var(--space-3);
  color: var(--color-text-soft);
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  font-size: var(--text-small);
}

.secondary-metrics strong {
  color: var(--color-text);
}

.tracker-tools,
.request-list {
  display: grid;
  gap: var(--space-4);
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xl);
}

.request-main {
  min-width: 0;
}

.request-title {
  margin: 0 0 var(--space-1);
  color: var(--color-text);
  font-size: var(--text-card-title);
  font-weight: 650;
  line-height: 1.2;
}

.request-description {
  margin: 0;
  color: var(--color-text-soft);
  font-size: var(--text-small);
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.request-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.request-actions--inline {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-field {
  width: 120px;
}

.row-control {
  min-height: 44px;
  border-radius: var(--radius-pill);
}

.row-toggle {
  min-width: 132px;
}

.message-panel {
  display: grid;
  gap: var(--space-4);
}

.message-preview {
  min-height: 260px;
  padding: var(--space-5);
  color: var(--color-text-soft);
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xl);
  white-space: pre-wrap;
}

.message-preview--empty {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-3);
  min-height: 320px;
  white-space: normal;
}

.message-preview--empty h3,
.message-preview--empty p {
  margin: 0;
}

.toast {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: var(--space-2);
  width: fit-content;
  padding: 0 var(--space-4);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-control);
  font-weight: 600;
  transition: opacity 160ms var(--ease-soft), transform 160ms var(--ease-soft);
}

.toast--hidden {
  pointer-events: none;
  opacity: 0;
  transform: translateY(var(--space-3));
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
}

.project-card-body {
  min-width: 0;
}

.project-card-client {
  margin: 0 0 var(--space-1);
  color: var(--color-text);
  font-size: var(--text-card-title);
  font-weight: 650;
  line-height: 1.2;
}

.project-card-name {
  margin: 0;
  color: var(--color-text-soft);
  font-size: var(--text-small);
}

.project-card-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-2);
}

.loading-text,
.error-text {
  padding: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-small);
}

.error-text {
  color: var(--color-red);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  padding: var(--space-6);
  color: var(--color-text-soft);
  background: var(--color-surface-soft);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-xl);
}

.empty-state p {
  margin: 0;
}

@media (max-width: 680px) {
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .segmented-control {
    width: 100%;
    border-radius: var(--radius-xl);
  }

  .toolbar-group,
  .segment {
    flex: 1 1 auto;
  }

  .button-pill {
    white-space: normal;
  }

  .request-row {
    grid-template-columns: 1fr;
  }

  .request-actions {
    justify-content: space-between;
  }

  .request-actions--inline,
  .row-field,
  .row-toggle {
    width: 100%;
  }

  .toast {
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    width: auto;
  }
}
