/* Oak Admin design system.
 *
 * Plain CSS, dark only. Everything is built from the tokens below: change a
 * token, not a component. Components are rendered by
 * OakAdmin.CoreComponents and OakAdmin.Layouts, one class per component
 * (`.btn`, `.card`, `.table`...) with `--modifier` variants.
 *
 *   1. Tokens
 *   2. Base
 *   3. Layout (shell, sidebar, page)
 *   4. Components
 *   5. Utilities
 */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Surfaces, from the page background up */
  --color-bg: #0c0e12;
  --color-surface-1: #12151b;
  --color-surface-2: #181c23;
  --color-surface-3: #20252e;
  --color-overlay: rgb(255 255 255 / 0.04);
  --color-overlay-strong: rgb(255 255 255 / 0.07);

  /* Lines */
  --color-border: #232831;
  --color-border-strong: #313844;

  /* Text */
  --color-text: #e7e9ee;
  --color-text-muted: #9ba3b0;
  --color-text-subtle: #6a7381;

  /* Accent (actions, focus, current page) */
  --color-accent: #8b93ff;
  --color-accent-hover: #a2a8ff;
  --color-accent-soft: rgb(139 147 255 / 0.14);
  --color-accent-contrast: #0c0e12;

  /* Status */
  --color-success: #46d39a;
  --color-success-soft: rgb(70 211 154 / 0.12);
  --color-warning: #f2b44c;
  --color-warning-soft: rgb(242 180 76 / 0.12);
  --color-danger: #f26b6b;
  --color-danger-soft: rgb(242 107 107 / 0.12);
  --color-info: #5fb1ff;
  --color-info-soft: rgb(95 177 255 / 0.12);

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* Space (4px grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Shape */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 999px;

  /* Depth */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.45), 0 2px 6px rgb(0 0 0 / 0.3);
  --ring: 0 0 0 1px var(--color-bg), 0 0 0 3px rgb(139 147 255 / 0.55);

  /* Motion */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Sizes */
  --sidebar-width: 15rem;
  --content-max-width: 72rem;
  --control-height: 2.25rem;
  --control-height-sm: 1.875rem;
}

/* 2. Base ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

code,
kbd,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

::selection {
  background: var(--color-accent-soft);
}

[hidden] {
  display: none !important;
}

/* 3. Layout ---------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* The top bar and the sidebar's close button and backdrop are only shown on
   small screens (see the end of this file) */
.topbar,
.sidebar .sidebar-close,
.sidebar-backdrop {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  height: 100vh;
  height: 100dvh;
  padding: var(--space-4) var(--space-3);
  background: var(--color-surface-1);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-group-title {
  padding: 0 var(--space-2) var(--space-1);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 2rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-weight: var(--weight-medium);
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.sidebar-link:hover {
  background: var(--color-overlay);
  color: var(--color-text);
}

.sidebar-link[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.sidebar-link[aria-current="page"] .icon {
  color: var(--color-accent);
}

/* A link that opens in a new tab: a small arrow at the end */
.sidebar-link-external {
  margin-left: auto;
  color: var(--color-text-subtle);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: auto;
}

/* The signed in account, at the top of the sidebar */
.sidebar-account {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-1) var(--space-2);
}

.sidebar-account .avatar {
  border-radius: var(--radius-full);
}

.sidebar-account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: var(--leading-tight);
}

.sidebar-account-name,
.sidebar-account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-name {
  font-weight: var(--weight-semibold);
}

.sidebar-account-email {
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
}

/* Who of our team is in the backoffice: how many, and who on hover */
.online {
  position: relative;
}

.online-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 2rem;
  padding: 0 var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: var(--weight-medium);
  cursor: default;
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.online-summary:hover,
.online-summary:focus-visible {
  background: var(--color-overlay);
  color: var(--color-text);
}

.online-summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.online-dot {
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.3125rem;
  border-radius: var(--radius-full);
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
}

.online-avatars {
  display: flex;
  margin-left: auto;
}

.online-avatars .avatar {
  width: 1.375rem;
  height: 1.375rem;
  border: 2px solid var(--color-surface-1);
  border-radius: var(--radius-full);
  font-size: 0.625rem;
}

.online-avatars .avatar + .avatar {
  margin-left: -0.375rem;
}

.online-list {
  position: absolute;
  bottom: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: 10;
  display: none;
  max-height: 18rem;
  padding: var(--space-2);
  overflow-y: auto;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-lg);
}

.online:hover .online-list,
.online:focus-within .online-list {
  display: block;
}

.online-list-title {
  padding: var(--space-1) var(--space-2) var(--space-2);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.online-admin {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-1) var(--space-2);
}

.online-admin .avatar {
  border-radius: var(--radius-full);
}

.online-admin-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The sign in page: our logo and the sign in button, in the middle of the
   screen */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-4);
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-10);
}

.login-logo {
  display: block;
  border-radius: var(--radius-md);
}

.login-logo img {
  display: block;
  width: 10rem;
  height: auto;
}

.login-logo:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Google's "Sign in with Google" button: their image, as is (see
   https://developers.google.com/identity/branding-guidelines) */
.google-button {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  transition: filter var(--duration-fast) var(--ease);
}

.google-button img {
  display: block;
}

.google-button:hover {
  filter: brightness(1.15);
}

.google-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.page {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-10) var(--space-12);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

.page-subtitle {
  margin-top: var(--space-2);
  max-width: 44rem;
  color: var(--color-text-muted);
}

.page-actions {
  display: flex;
  flex: none;
  gap: var(--space-2);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--color-text-subtle);
  font-size: var(--text-sm);
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* 4. Components ------------------------------------------------------------ */

/* Icon */

.icon {
  flex: none;
  width: 1rem;
  height: 1rem;
}

.icon--sm {
  width: 0.875rem;
  height: 0.875rem;
}

.icon--lg {
  width: 1.25rem;
  height: 1.25rem;
}

.icon--spin {
  animation: spin 1s linear infinite;
}

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

/* Button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-3);
  color: var(--color-text);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.btn:hover {
  background: #272d37;
  border-color: #3b4350;
}

.btn:disabled,
.btn.phx-submit-loading {
  opacity: 0.6;
  cursor: progress;
}

.btn--primary {
  border-color: transparent;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.btn--primary:hover {
  border-color: transparent;
  background: var(--color-accent-hover);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--color-text-muted);
}

.btn--ghost:hover {
  border-color: transparent;
  background: var(--color-overlay-strong);
  color: var(--color-text);
}

.btn--success {
  border-color: transparent;
  background: var(--color-success-soft);
  color: var(--color-success);
}

.btn--success:hover {
  border-color: transparent;
  background: rgb(70 211 154 / 0.2);
}

.btn--danger {
  border-color: transparent;
  background: transparent;
  color: var(--color-text-muted);
}

.btn--danger:hover {
  border-color: transparent;
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.btn--sm {
  height: var(--control-height-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

/* Card */

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-1);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.card-description {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Table */

/* Positioned, so what's absolutely positioned in the table (the
   `.sr-only` header of the actions) scrolls with it instead of widening the
   page */
.table-wrap {
  position: relative;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.table th {
  height: 2.5rem;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background var(--duration-fast) var(--ease);
}

.table tbody tr:hover {
  background: var(--color-overlay);
}

.table th:first-child,
.table td:first-child {
  padding-left: var(--space-5);
}

.table th:last-child,
.table td:last-child {
  padding-right: var(--space-5);
}

.table-clickable {
  cursor: pointer;
}

.table-actions {
  width: 1%;
  white-space: nowrap;
}

.table-actions-inner {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
}

/* Numbers line up on the right, their header too (.table th is left
   aligned) */
.table .table-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Short values under a wider header (counts...) are centered on it */
.table .table-center {
  text-align: center;
}

/* Form fields */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-label {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.field-hint {
  color: var(--color-text-subtle);
  font-size: var(--text-sm);
}

.field-error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-danger);
  font-size: var(--text-sm);
}

.control {
  width: 100%;
  height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-base);
  transition:
    border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

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

.control:hover {
  border-color: #3b4350;
}

.control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.control--invalid,
.control--invalid:hover {
  border-color: var(--color-danger);
}

.control--invalid:focus {
  box-shadow: 0 0 0 3px var(--color-danger-soft);
}

textarea.control {
  height: auto;
  min-height: 6rem;
  padding: var(--space-2) var(--space-3);
}

select.control {
  appearance: none;
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ba3b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 1rem;
}

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

.checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent);
}

.search {
  position: relative;
}

.search .icon {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  color: var(--color-text-subtle);
  transform: translateY(-50%);
  pointer-events: none;
}

.search .control {
  padding-left: var(--space-8);
}

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

.form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* Toolbar (filters above a table) */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.toolbar .search {
  width: 18rem;
}

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

/* Pagination (in a card footer) */

.pagination {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.pagination-links {
  display: flex;
  gap: var(--space-2);
}

/* Badge */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 1.375rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-overlay-strong);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.badge--accent {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.badge--success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge--info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

/* Avatar (organization icons, initials as a fallback) */

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-3);
  color: var(--color-text-muted);
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: var(--text-xs);
}

.avatar--md {
  width: 2.5rem;
  height: 2.5rem;
  font-size: var(--text-sm);
}

.avatar--lg {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: var(--radius-lg);
  font-size: var(--text-xl);
}

/* Media row (avatar or thumbnail, then text and actions) */

.media {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.media-body {
  flex: 1;
  min-width: 0;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.cell-with-avatar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* File input: the native input is hidden, its label is styled as a button */

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-input:focus-visible + .btn {
  box-shadow: var(--ring);
}

/* Catalog columns (makes, models, versions) */

.catalog {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.catalog .toolbar {
  padding: var(--space-3);
}

.catalog .toolbar form,
.catalog .toolbar .search {
  width: 100%;
}

.catalog .empty {
  padding: var(--space-8) var(--space-4);
}

.entry-list {
  max-height: 26rem;
  padding: var(--space-1);
  overflow-y: auto;
}

.entry {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 2.25rem;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.entry:hover {
  background: var(--color-overlay);
  color: var(--color-text);
}

.entry[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

.entry-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-caret {
  color: var(--color-text-subtle);
}

.entry[aria-current="page"] .entry-caret {
  color: var(--color-accent);
}

/* Section title (inside a card or a sheet) */

.section-title {
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Inline add form (an input and its button on one line) */

.inline-add {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: var(--space-2);
}

.inline-add .field {
  flex: 1;
  min-width: 0;
}

/* Chip (small inline token, e.g. what a shop typed) */

.chip {
  display: inline-block;
  max-width: 16rem;
  padding: 1px var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Description list */

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--space-5);
}

.details dt {
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Long values without spaces (emails, VINs) wrap instead of running into the next column */
.details > * {
  min-width: 0;
}

.details dd {
  margin-top: var(--space-1);
  overflow-wrap: anywhere;
}

/* Count link (e.g. an organization's customers, in a table cell) */

.count-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.count-link:hover {
  background: var(--color-overlay);
  color: var(--color-text);
}

/* Record id (what lists show instead of personal data) */

.record-id {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.record-id--link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* Filter chip (a filter set by a link, e.g. a vehicle, removed by clicking it) */

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.filter-chip:hover {
  background: var(--color-overlay);
  color: var(--color-text);
}

/* License plate (a vehicle's, with where it's from when foreign) */

.license-plate {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
}

.plate {
  display: inline-block;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Customer details: one line per address line, notes as typed */

.address-line {
  display: block;
}

.notes {
  white-space: pre-line;
}

/* Empty state */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-overlay-strong);
  color: var(--color-text-subtle);
}

.empty-title {
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

/* Banner (inline notice inside a page) */

.banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}

.banner-text {
  flex: 1;
}

.banner--success .icon {
  color: var(--color-success);
}

.banner--danger .icon {
  color: var(--color-danger);
}

/* Toasts (flash messages) */

.toasts {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(24rem, calc(100vw - 2 * var(--space-6)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-3);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-body .icon {
  vertical-align: -0.125em;
}

.toast-title {
  font-weight: var(--weight-semibold);
}

.toast-close {
  flex: none;
  width: var(--control-height-sm);
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-2)) 0 0;
  padding: 0;
  color: var(--color-text-subtle);
}

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

.toast--info > .icon {
  color: var(--color-success);
}

.toast--error > .icon {
  color: var(--color-danger);
}

/* Sheet (side panel over the page) */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.55);
  animation: sheet-fade var(--duration-normal) var(--ease);
}

.sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(30rem, 100vw);
  border-left: 1px solid var(--color-border-strong);
  background: var(--color-surface-1);
  box-shadow: var(--shadow-lg);
  animation: sheet-slide var(--duration-normal) var(--ease);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.sheet-heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.sheet-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
}

.sheet-subtitle {
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.sheet-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6);
  overflow-y: auto;
}

.sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.sheet-footer-end {
  display: flex;
  gap: var(--space-2);
}

.divider {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--color-border);
}

@keyframes sheet-slide {
  from {
    transform: translateX(100%);
  }
}

@keyframes sheet-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-backdrop {
    animation: none;
  }
}

/* Transitions used by the show/hide JS commands */

.fade-transition {
  transition:
    opacity var(--duration-normal) var(--ease),
    transform var(--duration-normal) var(--ease);
}

.fade-out {
  opacity: 0;
  transform: translateY(0.5rem);
}

.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* 5. Utilities ------------------------------------------------------------- */

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

.text-subtle {
  color: var(--color-text-subtle);
}

.text-strong {
  font-weight: var(--weight-medium);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Small screens: a top bar, whose button opens the sidebar over the page
   (see OakAdmin.Layouts.app/1) */

@media (max-width: 48rem) {
  .shell {
    grid-template-rows: auto 1fr;
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 3.5rem;
    padding: 0 var(--space-2);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-1);
  }

  .topbar-menu {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    color: var(--color-text);
  }

  .topbar-logo {
    display: block;
    padding: var(--space-1);
    border-radius: var(--radius-md);
  }

  .topbar-logo img {
    display: block;
    width: auto;
    height: 1.75rem;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(18rem, calc(100vw - 3rem));
    padding-top: var(--space-3);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
    overscroll-behavior: contain;
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform var(--duration-normal) var(--ease),
      visibility 0s linear var(--duration-normal);
  }

  .sidebar-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform var(--duration-normal) var(--ease);
  }

  .sidebar .sidebar-close {
    display: inline-flex;
    align-self: flex-end;
    width: 2.25rem;
    height: 2.25rem;
    margin-bottom: calc(-1 * var(--space-4));
    padding: 0;
  }

  .sidebar-open .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: rgb(0 0 0 / 0.55);
    animation: sheet-fade var(--duration-normal) var(--ease);
  }

  /* The page doesn't scroll under the open sidebar */
  body:has(.sidebar-open) {
    overflow: hidden;
  }

  /* Bigger targets for fingers */
  .sidebar-link,
  .online-summary {
    height: 2.75rem;
  }

  .page {
    padding: var(--space-5) var(--space-4) var(--space-10);
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }

  .page-title {
    font-size: var(--text-xl);
  }

  .page-actions {
    flex-wrap: wrap;
  }

  .card-header,
  .card-footer,
  .sheet-footer,
  .media {
    flex-wrap: wrap;
  }

  .card-header,
  .card-body {
    padding: var(--space-4);
  }

  /* Rows stay on one line: the table scrolls sideways, in its card, instead
     of squeezing its columns into a word per line */
  .table td {
    white-space: nowrap;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: var(--space-4);
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: var(--space-4);
  }

  .toolbar {
    padding: var(--space-3) var(--space-4);
  }

  .toolbar > *,
  .toolbar form,
  .toolbar-filters,
  .toolbar-filters > *,
  .toolbar .search {
    width: 100%;
  }

  .catalog,
  .form-grid--2,
  .form-grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Text of 16px at least, or iOS zooms in on the field being typed in */
  .control {
    font-size: var(--text-lg);
  }

  .sheet {
    width: 100vw;
    border-left: none;
  }

  .sheet-header {
    padding: var(--space-4);
  }

  .sheet-body {
    padding: var(--space-4);
  }

  .sheet-footer {
    padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
  }

  .toasts {
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    left: var(--space-4);
    width: auto;
  }
}

@media (max-width: 48rem) and (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-open .sidebar,
  .sidebar-open .sidebar-backdrop {
    animation: none;
    transition: none;
  }
}

/* An organization and what it typed, side by side */
.proposed-by {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
