/* ==========================================================================
   ausbeds-warm · design system · components
   --------------------------------------------------------------------------
   SILOED COPY · canonical source: huashu/references/ausbeds-warm-design/
   If this file lives anywhere other than that path, you're looking at a
   synced copy — edit the source, not this file, then re-sync.
   --------------------------------------------------------------------------
   Depends on tokens.css. Fully token-driven so the look reskins
   automatically when [data-theme="dark"] flips Day → Night. Buttons,
   inputs, cards, tables, badges, status, modals, tabs, toolbars, lists,
   dropdown, tooltip, toast, meter, native date inputs.

   Wrapped in `@layer ausbeds-warm` — see tokens.css for the cascade
   convention.
   ========================================================================== */

@layer ausbeds-warm {

/* ============================= BUTTONS ================================== */
.btn {
  --btn-bg:        var(--accent);
  --btn-fg:        var(--accent-fg);
  --btn-border:    transparent;
  --btn-bg-hover:  var(--accent-hover);
  --btn-bg-active: var(--accent-active);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 7px 14px;
  min-height: 32px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
  user-select: none;
}
.btn:hover  { background: var(--btn-bg-hover); }
.btn:active { background: var(--btn-bg-active); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn[disabled], .btn:disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}

.btn--secondary {
  --btn-bg:        var(--bg-panel);
  --btn-fg:        var(--fg-1);
  --btn-border:    var(--line-2);
  --btn-bg-hover:  var(--bg-hover);
  --btn-bg-active: var(--bg-active);
}
.btn--ghost {
  --btn-bg:        transparent;
  --btn-fg:        var(--fg-2);
  --btn-border:    transparent;
  --btn-bg-hover:  var(--bg-hover);
  --btn-bg-active: var(--bg-active);
}
.btn--ghost:hover { color: var(--fg-1); }

.btn--danger {
  --btn-bg:        var(--danger);
  --btn-fg:        var(--accent-fg);
  --btn-border:    transparent;
  --btn-bg-hover:  color-mix(in srgb, var(--danger) 88%, black 12%);
  --btn-bg-active: color-mix(in srgb, var(--danger) 76%, black 24%);
}
.btn--ink {
  --btn-bg:        var(--fg-1);
  --btn-fg:        var(--bg-panel);
  --btn-border:    transparent;
  --btn-bg-hover:  color-mix(in srgb, var(--fg-1) 88%, black 12%);
  --btn-bg-active: color-mix(in srgb, var(--fg-1) 76%, black 24%);
}

.btn--sm { padding: 4px 10px; min-height: 26px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn--lg { padding: 10px 18px; min-height: 40px; font-size: var(--fs-md); }
.btn--icon { padding: 0; width: 32px; min-height: 32px; }
.btn--icon.btn--sm { width: 26px; min-height: 26px; }
.btn--block { display: flex; width: 100%; }

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn--lg svg { width: 16px; height: 16px; }


/* ============================= INPUTS =================================== */
.input, .textarea, .select {
  display: block;
  width: 100%;
  padding: 6px 10px;
  min-height: 32px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--fg-1);
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--gray-500); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
.input[disabled], .textarea[disabled], .select[disabled] {
  background: var(--bg-sunken); color: var(--fg-3); cursor: not-allowed;
}
.textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.input--sm { min-height: 26px; padding: 3px 8px; font-size: var(--fs-xs); }
.input--lg { min-height: 40px; font-size: var(--fs-md); padding: 8px 12px; }

.input--invalid, .input.is-invalid { border-color: var(--danger); }
.input--invalid:focus, .input.is-invalid:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%236c6f85' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%23a6adc8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg-1);
}
.label--req::after {
  content: '*';
  color: var(--danger);
  margin-left: 3px;
}
.help {
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
.help--error { color: var(--danger); }

.field { display: flex; flex-direction: column; }
.field + .field { margin-top: var(--space-5); }

.input-wrap { position: relative; display: block; }
.input-wrap > svg {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 9px;
  width: 14px; height: 14px;
  color: var(--fg-3);
  pointer-events: none;
}
.input-wrap .input { padding-left: 30px; }

.checkbox, .radio {
  appearance: none;
  -webkit-appearance: none;
  width: 15px; height: 15px;
  border: 1.5px solid var(--line-2);
  background: var(--bg-panel);
  cursor: pointer;
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.checkbox { border-radius: 3px; }
.radio { border-radius: 999px; }
.checkbox:hover, .radio:hover { border-color: var(--gray-500); }
.checkbox:focus-visible, .radio:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.5l2.5 2.5 4.5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 10px;
}
.radio:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg-panel);
}


/* ============================= CARDS / PANELS =========================== */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.card--flat     { box-shadow: none; }
.card--raised   { box-shadow: var(--shadow-sm); }
.card--elevated { box-shadow: var(--shadow-md); border-color: transparent; }

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line-3);
}
.card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--fg-1);
  flex: 1;
}
.card-sub { font-size: var(--fs-xs); color: var(--fg-3); }
.card-body { padding: var(--space-5); }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line-3);
  background: var(--bg-sunken);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}


/* ============================= BADGES / STATUS ========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 1.5;
  color: var(--fg-2);
  background: var(--neutral-bg);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.badge--pill    { border-radius: var(--radius-pill); padding: 2px 10px; }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--accent  { background: var(--accent-soft); color: var(--accent); }
.badge--ink     { background: var(--fg-1); color: var(--bg-panel); }
.badge--outline { background: transparent; border-color: var(--line-2); color: var(--fg-2); }

.badge--dot::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
  margin-right: 2px;
}


/* ============================= TABS ===================================== */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--line-1);
  padding: 0 var(--space-5);
}
.tab {
  position: relative;
  padding: 10px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg-3);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--dur-fast);
}
.tab:hover { color: var(--fg-1); }
.tab[aria-selected="true"], .tab.is-active { color: var(--fg-1); }
.tab[aria-selected="true"]::after, .tab.is-active::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-sm);
}
.segmented > button {
  padding: 4px 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-3);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.segmented > button:hover { color: var(--fg-1); }
.segmented > button[aria-selected="true"],
.segmented > button.is-active {
  background: var(--bg-panel);
  color: var(--fg-1);
  box-shadow: var(--shadow-xs);
}


/* ============================= TABLES =================================== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.table th, .table td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-3);
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-sunken);
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
  border-bottom: 1px solid var(--line-1);
  white-space: nowrap;
}
.table thead th.is-sortable { cursor: pointer; user-select: none; }
.table thead th.is-sortable:hover { color: var(--fg-1); }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr.is-selected {
  background: var(--accent-softer);
  box-shadow: inset 2px 0 0 var(--accent);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table--zebra tbody tr:nth-child(even) { background: var(--bg-sunken); }
.table--zebra tbody tr:nth-child(even):hover { background: var(--bg-hover); }
.table--compact th, .table--compact td { padding: 5px 10px; }
.table--bordered {
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.table--bordered th, .table--bordered td { border-right: 1px solid var(--line-3); }
.table--bordered th:last-child, .table--bordered td:last-child { border-right: 0; }


/* ============================= LIST ROWS ================================ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-3);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.list-item:hover { background: var(--bg-hover); }
.list-item.is-selected {
  background: var(--accent-softer);
  box-shadow: inset 3px 0 0 var(--accent);
}
.list-item.is-unread { background: var(--bg-panel); }
.list-item.is-read   { background: var(--bg-sunken); }
.list-item-main { flex: 1; min-width: 0; }
.list-item-top {
  display: flex; align-items: baseline; gap: var(--space-3);
  margin-bottom: 2px;
}
.list-item-name {
  font-weight: 600; font-size: var(--fs-sm); color: var(--fg-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-time {
  margin-left: auto;
  font-size: var(--fs-2xs);
  color: var(--fg-3);
  flex-shrink: 0;
}
.list-item-title {
  font-size: var(--fs-sm); color: var(--fg-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-preview {
  font-size: var(--fs-xs); color: var(--fg-3);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ============================= TOOLBAR / FILTER BAR ===================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line-1);
  min-height: 44px;
}
.toolbar > .spacer { flex: 1; }
.toolbar-group {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-1);
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.chip:hover { border-color: var(--line-2); }
.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.chip > .chip-x {
  font-size: 14px; line-height: 1;
  color: var(--fg-4);
  margin-left: 2px;
}
.chip:hover > .chip-x { color: var(--fg-2); }


/* ============================= MODAL / DRAWER =========================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 17, 27, 0.46);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-standard);
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }

.modal {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: var(--bg-panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(6px) scale(0.99);
  transition: transform var(--dur-med) var(--ease-standard);
}
.modal-backdrop.is-open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--line-3);
}
.modal-title { font-size: var(--fs-lg); font-weight: 700; flex: 1; }
.modal-body { padding: var(--space-5); overflow: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-5);
  border-top: 1px solid var(--line-3);
  background: var(--bg-sunken);
}

.drawer {
  position: fixed; top: 0; bottom: 0; right: 0;
  width: min(480px, 100vw);
  background: var(--bg-panel);
  border-left: 1px solid var(--line-1);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-standard);
  z-index: 90;
  display: flex;
  flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }


/* ============================= BANNER / CALLOUT ========================= */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 10px 14px;
  font-size: var(--fs-sm);
  color: var(--fg-1);
  background: var(--info-bg);
  border: 1px solid var(--info-line);
  border-radius: var(--radius-sm);
}
.banner--success { background: var(--success-bg); border-color: var(--success-line); }
.banner--warning { background: var(--warning-bg); border-color: var(--warning-line); }
.banner--danger  { background: var(--danger-bg);  border-color: var(--danger-line); }
.banner-title { font-weight: 700; }
.banner-body  { color: var(--fg-2); }


/* ============================= AVATAR =================================== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 22px; height: 22px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: var(--fs-md); }


/* ============================= APP SHELL PRIMITIVES ===================== */
.app-topbar {
  display: flex; align-items: center; gap: var(--space-4);
  height: var(--chrome-topbar-h);
  padding: 0 var(--space-5);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line-1);
  flex-shrink: 0;
}
.app-sidebar {
  width: var(--chrome-sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--line-1);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-3);
  flex-shrink: 0;
  gap: 2px;
}
.navlink {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 6px 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.navlink:hover { background: var(--bg-hover); color: var(--fg-1); text-decoration: none; }
.navlink.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.navlink svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.85; }
.navlink-count {
  margin-left: auto;
  font-size: var(--fs-2xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.nav-section {
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
}
.nav-section:first-child { padding-top: 0; }


/* ============================= DIVIDERS / HR ============================ */
.hr {
  border: 0;
  border-top: 1px solid var(--line-1);
  margin: var(--space-6) 0;
}
.hr--dashed { border-top-style: dashed; }


/* ============================= UTILITIES ================================ */
.stack { display: flex; flex-direction: column; }
.row   { display: flex; align-items: center; }
.grow  { flex: 1; }
.muted { color: var(--fg-3); }
.mono  { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }


/* ============================= DROPDOWN MENU ============================
   Trigger + positioned menu. JS-toggleable via .is-open on the wrapper.
   Items align left by default; separators are 1px hairlines. Common use:
   row-level actions ("⋯ archive / snooze / mark spam"), user menus,
   "more" menus on toolbars.
   ========================================================================= */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  padding: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
}
.dropdown.is-open > .dropdown-menu,
.dropdown-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown-menu--start { right: auto; left: 0; }
.dropdown-menu--up    { top: auto; bottom: calc(100% + 4px); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-1);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background var(--dur-fast);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.dropdown-item[disabled], .dropdown-item:disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.dropdown-item--danger { color: var(--danger); }
.dropdown-item--danger:hover { background: var(--danger-bg); }

.dropdown-item svg {
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--fg-3);
}
.dropdown-item:hover svg { color: var(--fg-1); }
.dropdown-item--danger svg, .dropdown-item--danger:hover svg { color: var(--danger); }

.dropdown-item-shortcut {
  margin-left: auto;
  padding-left: var(--space-5);
  font-size: var(--fs-2xs);
  color: var(--fg-3);
  font-family: var(--font-mono);
}

.dropdown-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--line-3);
}

.dropdown-section {
  padding: 6px 10px 4px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
}


/* ============================= TOOLTIP ==================================
   Pure-CSS tooltip via data-tooltip attribute. Wrap any element (icon
   button, badge, truncated text) with [data-tooltip="…"] and you get
   a hover-revealed label. Position defaults to top; data-tooltip-pos
   accepts "bottom" | "left" | "right".
   ========================================================================= */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::before,
[data-tooltip]::after {
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-standard) 100ms;
  position: absolute;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  font-size: var(--fs-2xs);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--fg-inv);
  background: var(--ink);
  border-radius: var(--radius-xs);
  z-index: 90;
}
[data-tooltip]::before {
  content: '';
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
  z-index: 90;
}
[data-tooltip]:hover::before,
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::before,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* Position variants */
[data-tooltip-pos="bottom"]::after {
  bottom: auto; top: calc(100% + 6px);
}
[data-tooltip-pos="bottom"]::before {
  bottom: auto; top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}
[data-tooltip-pos="right"]::after {
  bottom: auto; top: 50%; left: calc(100% + 6px);
  transform: translateY(-50%);
}
[data-tooltip-pos="right"]::before {
  bottom: auto; top: 50%; left: calc(100% + 2px);
  transform: translateY(-50%);
  border-top-color: transparent;
  border-right-color: var(--ink);
}
[data-tooltip-pos="left"]::after {
  bottom: auto; top: 50%; right: calc(100% + 6px); left: auto;
  transform: translateY(-50%);
}
[data-tooltip-pos="left"]::before {
  bottom: auto; top: 50%; right: calc(100% + 2px); left: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-left-color: var(--ink);
}


/* ============================= TOAST / NOTIFICATION =====================
   Transient confirmations: "Sent", "Saved", "Snoozed for 2h". Stacks in
   the bottom-right (.toast-stack). Each .toast slides in, holds, then
   the app removes it (typically after 3–5s). Different from .banner
   (which is a persistent in-page status row).
   ========================================================================= */
.toast-stack {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 110;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast-stack > * { pointer-events: auto; }

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 10px 12px;
  background: var(--bg-raised);
  color: var(--fg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  transform: translateY(8px);
  opacity: 0;
  animation: toast-in var(--dur-slow) var(--ease-standard) forwards;
}
@keyframes toast-in {
  to { transform: translateY(0); opacity: 1; }
}
.toast.is-leaving {
  animation: toast-out var(--dur-med) var(--ease-standard) forwards;
}
@keyframes toast-out {
  to { transform: translateY(-4px); opacity: 0; }
}

.toast-icon {
  flex-shrink: 0;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  margin-top: 1px;
  color: var(--fg-3);
}
.toast--success .toast-icon { color: var(--success); }
.toast--warning .toast-icon { color: var(--warning); }
.toast--danger  .toast-icon { color: var(--danger); }
.toast--info    .toast-icon { color: var(--info); }
.toast--accent  .toast-icon { color: var(--accent); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; color: var(--fg-1); }
.toast-meta  { color: var(--fg-3); font-size: var(--fs-xs); margin-top: 2px; }

.toast-close {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  color: var(--fg-4);
  cursor: pointer;
  font-size: 14px; line-height: 1;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.toast-close:hover { background: var(--bg-hover); color: var(--fg-1); }


/* ============================= METER / PROGRESS =========================
   Numeric-target progress bar — "27 of 38 hours logged", "75% of target",
   "12 of 50 in stock". Used across timesheet / P&L / inventory.

   Set the fill width via inline style (--fill: 75%) or a JS-set
   --meter-fill custom property. Variants tint the fill colour to
   match status (success / warning / danger / accent).
   ========================================================================= */
.meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.meter-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-size: var(--fs-xs);
}
.meter-label {
  color: var(--fg-2);
  font-weight: 500;
}
.meter-value {
  margin-left: auto;
  color: var(--fg-1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.meter-meta {
  color: var(--fg-3);
  font-size: var(--fs-2xs);
}
.meter-track {
  height: 6px;
  background: var(--bg-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  width: var(--meter-fill, 0%);
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease-standard);
}
.meter--sm .meter-track { height: 4px; }
.meter--lg .meter-track { height: 10px; }

.meter--success .meter-fill { background: var(--success); }
.meter--warning .meter-fill { background: var(--warning); }
.meter--danger  .meter-fill { background: var(--danger); }
.meter--info    .meter-fill { background: var(--info); }

/* Segmented variant — overlay tick marks for "5 of 8" style targets */
.meter--segmented .meter-track {
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(var(--meter-segment, 12.5%) - 1px),
    var(--bg-page) calc(var(--meter-segment, 12.5%) - 1px),
    var(--bg-page) var(--meter-segment, 12.5%)
  );
}


/* ============================= DATE / TIME / WEEK INPUTS ================
   Native HTML5 inputs (type=date / type=week / type=time / type=month)
   inherit the .input chrome — but the native picker indicator on Chrome
   gets a touch awkward in cream + dark modes. Tiny tweaks here normalize
   it. Pair with .input-wrap + calendar SVG when you want a leading icon.
   ========================================================================= */
.input[type="date"],
.input[type="week"],
.input[type="time"],
.input[type="month"],
.input[type="datetime-local"] {
  font-family: var(--font-sans);
  /* Reserve space for the native picker indicator on the right */
  padding-right: 28px;
}
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="week"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator,
.input[type="month"]::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  filter: none;
  transition: opacity var(--dur-fast);
}
.input[type="date"]:hover::-webkit-calendar-picker-indicator,
.input[type="week"]:hover::-webkit-calendar-picker-indicator,
.input[type="time"]:hover::-webkit-calendar-picker-indicator,
.input[type="month"]:hover::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator {
  opacity: 0.9;
}
[data-theme="dark"] .input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .input[type="week"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
}

} /* end @layer ausbeds-warm */
