/* The design system's look (docs/specs/design-system.md; the owner's decision of 2026-10-26) over the mockups'
 * components.css, loaded after it. The same rules as apps/web/src/styles/components.css: keep them in step. */

/* ---------- Buttons ---------- */
/* One size of text button everywhere (32px); the press sinks fast and springs back slower, a hover lifts 1px.
 * The individual scale/translate properties keep a hover lift and a press from fighting over one transform. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  font-size: var(--text-sm); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); cursor: pointer; white-space: nowrap; text-decoration: none;
  position: relative; overflow: hidden; user-select: none;
  transition: scale 380ms var(--ease-spring), translate 380ms var(--ease-spring), background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, box-shadow 220ms ease-out;
}
.btn .icon { width: 14px; height: 14px; }
.btn:hover { background: var(--color-surface-hover); border-color: color-mix(in srgb, var(--color-text) 25%, transparent); text-decoration: none; }
.btn:hover:not(:active):not(:disabled) { translate: 0 -1px; }
.btn:active:not(:disabled) { scale: 0.955; translate: 0 0; transition-duration: 70ms, 70ms, 100ms, 100ms, 100ms, 100ms; }
.btn-primary { background: var(--color-accent); border-color: transparent; color: var(--color-accent-text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 18px -8px color-mix(in srgb, var(--color-accent) 60%, transparent); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-press); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.22); }
/* A soft band of light sweeps across a filled button on hover. */
.btn-primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; translate: -110% 0; transition: translate 0s;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.3) 50%, transparent 65%);
}
.btn-primary:hover:not(:disabled)::after { translate: 110% 0; transition: translate 750ms var(--ease-out); }
.btn-danger { background: var(--color-danger-soft); border-color: transparent; color: var(--color-danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--color-danger) 18%, var(--color-surface)); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-text-2); }
.btn-ghost:hover { background: var(--color-surface-hover); border-color: transparent; color: var(--color-text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { height: 40px; padding: 0 16px; font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--color-accent-ink); font-weight: var(--weight-medium); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .btn:active, .btn:hover { scale: none !important; translate: none !important; }
  .btn-primary::after { display: none; }
}



/* ---------- Forms ---------- */
.input, .select, .textarea {
  height: 36px; padding: 0 12px; width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--text-base);
  transition: border-color var(--duration-fast) ease-out, box-shadow var(--duration-fast) ease-out;
}
.label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 40%, transparent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-danger); box-shadow: 0 0 0 3px var(--color-danger-soft); }
.code-box.active { border-color: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 40%, transparent); }
.segmented { display: inline-flex; gap: 4px; padding: 3px; background: color-mix(in srgb, var(--color-text) 5%, transparent); border: 1px solid var(--color-border); border-radius: var(--radius-pill); max-width: 100%; overflow-x: auto; }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 14px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-2); cursor: pointer; white-space: nowrap; }
.segmented button:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.segmented button[aria-pressed="true"] { background: var(--color-accent); color: var(--color-accent-text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 10px -3px color-mix(in srgb, var(--color-accent) 50%, transparent); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-pill); font-size: 12.5px; color: var(--color-text-2); background: transparent; cursor: pointer; }

/* ---------- Cards ---------- */
/* A card separates from the canvas by its surface, with no border or shadow; a card inside a card (or on a
 * white surface) gets a 1px border instead. */
.card { background: var(--color-surface); border: 1px solid transparent; border-radius: var(--radius-lg); }
.card .card, .modal .card, .sidebar .card { border-color: var(--color-border); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 18px 20px 0; }
.card-head h2, .card-head h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 12px 20px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--color-border); background: color-mix(in srgb, var(--color-surface-2) 50%, transparent); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.card.inset { background: var(--color-surface-2); box-shadow: none; border-color: transparent; }
.list > li { display: flex; align-items: center; gap: var(--space-3); padding: 12px 20px; border-top: 1px solid var(--color-border); }
.list.tight > li { padding: 8px 20px; }
.table th { text-align: left; font-weight: var(--weight-medium); font-size: var(--text-xs); color: var(--color-text-3); padding: 8px 12px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }

/* ---------- Dialogs, toasts, avatars ---------- */
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--color-text); color: var(--color-surface); border-radius: var(--radius-pill); font-size: 13.5px; box-shadow: var(--shadow-lg); }
.modal { width: 100%; max-width: 460px; background: var(--color-surface); border: 0; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop var(--duration-slow) var(--ease-out); }
.modal-body h2 { font-size: var(--text-lg); margin-bottom: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--color-border); }
.modal-icon { width: 36px; height: 36px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.modal-foot { flex-wrap: wrap; }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-accent); color: var(--color-accent-text); font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: 0;
}
.avatar.agent { border-radius: 8px; background: var(--color-accent-soft); color: var(--color-accent-ink); }

/* ---------- App shell: the workspace sidebar, top bar and phone tab bar (mockups 07 and 10; issue #605) ----------
 * The sidebar is a white panel floating on the canvas, 12px in from the edges; the current entry is filled with
 * the accent, the others carry an accent icon. The page scrolls beside it. */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); gap: var(--shell-gap); padding: var(--shell-gap); min-height: 100vh; background: var(--color-bg); }
.sidebar {
  position: sticky; top: var(--shell-gap); height: calc(100vh - 2 * var(--shell-gap)); display: flex; flex-direction: column; min-height: 0;
  background: var(--color-surface); border-radius: var(--radius-xl); overflow: hidden;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 16px 20px; }
.sidebar .brand .brand-mark { width: 36px; height: 36px; }
.sidebar .brand-sub { color: var(--color-text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 8px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; }
.nav-section { font-size: var(--text-2xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-text-3); padding: 20px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius);
  color: var(--color-text-2); font-size: var(--text-base); text-decoration: none;
  transition: background-color var(--duration-fast) ease-out, color var(--duration-fast) ease-out, scale var(--duration-fast) ease-out;
}
.nav-item:hover { background: var(--color-surface-hover); color: var(--color-text); text-decoration: none; }
.nav-item:active { scale: 0.99; }
.nav-item[aria-current="page"] { background: var(--color-accent); color: var(--color-accent-text); font-weight: var(--weight-medium); }
.nav-item .icon { width: 18px; height: 18px; color: var(--color-accent); }
.nav-item[aria-current="page"] .icon { color: var(--color-accent-text); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: var(--weight-semibold); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-accent); color: var(--color-accent-text); }
.nav-item[aria-current="page"] .nav-count { background: var(--color-accent-text); color: var(--color-accent-ink); }
.nav-count.quiet { background: var(--color-surface-2); color: var(--color-text-2); }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--color-warn); }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--color-border); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--color-surface-2); }
.me .avatar { width: 32px; height: 32px; }
.topbar {
  height: var(--topbar-height); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-6);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--text-base); color: var(--color-text-2); min-width: 0; }
.crumbs b { color: var(--color-text); font-weight: var(--weight-semibold); }
.crumbs .sep { color: var(--color-text-3); }
.sidebar-powered { padding: 10px 12px 0; }
/* A screen that draws its own top bar with breadcrumbs (Agent Studio, mockups 21-25) replaces the shell's. */
.main:has(.main > .topbar) > .topbar { display: none; }
.tabbar { display: none; }
/* Entrance: translate and opacity only, on the expo curve. */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
.animate-in { animation: fade-up var(--duration-slow) var(--ease-out) both; }
.animate-in.d1 { animation-delay: 60ms; }
.animate-in.d2 { animation-delay: 120ms; }
.animate-in.d3 { animation-delay: 180ms; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--space-4); }
  .tabbar { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: 64px; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--color-border); background: var(--color-surface); padding: 6px 4px 10px; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--color-text-3); font-weight: var(--weight-medium); position: relative; text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--color-accent-ink); }
  .tabbar a[aria-current="page"] .icon { color: var(--color-accent); }
  .page { padding: var(--space-5) var(--space-4) 96px; }
}


/* What the mockups' shell drew that the design system doesn't. */
.app::before { display: none; }
.nav-item { height: auto; }
.me:hover { background: var(--color-surface-2); }
.topbar { border-bottom: 0; }
.icon-btn { border-color: transparent; color: var(--color-text-3); }
.icon-btn:hover { background: var(--color-surface-2); }
.page-head h1 { font-size: var(--text-xl); }
.sidebar { padding: 0; }
.nav-item[aria-current="page"] { box-shadow: none; }
