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

/* ---------- Buttons ---------- */
/* One size of text button everywhere (34px); 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: 34px; padding: 0 14px;
  border-radius: var(--radius-pill); 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); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: transparent; }
.btn-primary:active:not(:disabled) { background: var(--color-accent-press); }
.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: 30px; padding: 0 12px; font-size: var(--text-xs); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--text-md); }
.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; }
}



/* ---------- Forms ---------- */
.input, .select, .textarea {
  height: 40px; padding: 0 14px; width: 100%; border: 1px solid var(--color-border-strong); 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: 2px; padding: 3px; background: var(--color-surface-2); border: 0; border-radius: var(--radius-pill); max-width: 100%; overflow-x: auto; }
.segmented button { border: 0; background: transparent; height: 30px; padding: 0 14px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-2); cursor: pointer; white-space: nowrap; transition: background-color var(--duration-fast) ease-out, color var(--duration-fast) ease-out; }
.segmented button:hover { color: var(--color-text); }
.segmented button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-text); font-weight: var(--weight-semibold); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.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 a hairline 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); box-shadow: var(--shadow-sm); }
.card .card, .modal .card { border-color: var(--color-border); box-shadow: none; }
.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-lg); 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); background: transparent; }
.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 graphite room, the glass rail and the bright window ----------
 * The approved redesign of 9 Nov 2026, the same rules as apps/web/src/styles/shell.css. The room (--color-bg on the
 * shell) carries a slim floating glass rail of icons; the page is drawn in the bright window (.main.window). There
 * is no menu and no chat column here: the console's screens are all pages in the window.
 * Glass (backdrop blur) only on floating controls: the rail. Never on content. */
.app {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  gap: var(--shell-gap);
  padding: var(--shell-gap);
  min-height: 100vh;
  background: var(--color-bg);
}
.app > .main { grid-column: 2; grid-row: 1; min-width: 0; }

/* ---------- The rail ---------- */
.rail {
  grid-column: 1; grid-row: 1; position: sticky; top: var(--shell-gap); z-index: 30;
  height: calc(100vh - 2 * var(--shell-gap)); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 4px 0;
}
.rail-home { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.rail-home:hover { text-decoration: none; background: var(--color-surface-hover); }
.rail .brand-mark { width: 30px; height: 30px; background: transparent; color: var(--color-text); }
.rail .brand-mark::before { width: 80%; height: 80%; }
.rail-pill {
  display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--radius-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.rail-item {
  width: 48px; height: 48px; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center;
  color: var(--color-text-3); text-decoration: none; position: relative;
  transition: background-color var(--duration-fast) ease-out, color var(--duration-fast) ease-out, scale var(--duration-fast) ease-out;
}
.rail-item:hover { color: var(--color-text); background: var(--color-surface-hover); text-decoration: none; }
.rail-item:active { scale: 0.94; }
.rail-item[aria-current="page"] { background: var(--color-accent); color: var(--color-accent-text); }
.rail-item .icon { width: 20px; height: 20px; stroke-width: 2; }
.rail-me {
  width: 40px; height: 40px; border-radius: var(--radius-pill); border: 0; cursor: pointer;
  background: var(--color-surface-2); color: var(--color-text); font-size: var(--text-sm); font-weight: var(--weight-semibold); letter-spacing: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.rail-me:hover { background: var(--color-track); }

/* ---------- A page: drawn in the bright window ---------- */
.main.window { display: flex; flex-direction: column; min-height: calc(100vh - 2 * var(--shell-gap)); }
.main.window > .topbar { background: transparent; backdrop-filter: none; position: static; border-bottom: 0; padding: 0 var(--space-8); height: 64px; }
.main.window > .topbar .crumbs { font-size: var(--text-sm); }
.main.window > .page { flex: 1 1 auto; }

.topbar {
  height: var(--topbar-height); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-6);
}
.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); }
.page-head h1 { font-size: var(--text-xl); }
.icon-btn { border-radius: var(--radius-pill); color: var(--color-text-3); }
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ---------- Phone: the rail stays, the window loses its frame ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: var(--rail-width) minmax(0, 1fr); padding: 8px; gap: 8px; }
  .rail { top: 8px; height: calc(100vh - 16px); }
  .main.window { min-height: calc(100vh - 16px); border-radius: 24px; }
  /* Two rows: where you are and the theme button, then the console's own notice under them. */
  .main.window > .topbar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px;
    height: auto; padding: 10px var(--space-4);
  }
  .main.window > .topbar > .grow { display: none; }
  .main.window > .topbar > .crumbs { grid-area: 1 / 1; }
  .main.window > .topbar > .icon-btn { grid-area: 1 / 2; justify-self: end; }
  .main.window > .topbar > .pill { grid-area: 2 / 1 / 3 / 3; justify-self: start; }
  .page { padding: var(--space-5) var(--space-4) var(--space-8); }
}
