/* ── Layout ──────────────────────────────────── */
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0px; }
.min-w-8 { min-width: 2rem; }
.min-w-36 { min-width: 9rem; }
.min-w-40 { min-width: 10rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }


/* ── Sizing ──────────────────────────────────── */
.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.w-24 { width: 6rem; }
.w-32 { width: 8rem; }
.w-40 { width: 10rem; }
.w-64 { width: 16rem; }
.w-auto { width: auto; }
.w-full { width: 100%; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-fit { height: fit-content; }
.min-h-screen { min-height: 100vh; }
.min-h-\[10rem\] { min-height: 10rem; }
.max-w-xs { max-width: 20rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-7xl { max-width: 80rem; }

/* ── Spacing ─────────────────────────────────── */
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-2 { margin-left: 0.5rem; }
.ml-4 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-6 { margin-left: 1.5rem; }
.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pl-4 { padding-left: 1rem; }
.pl-5 { padding-left: 1.25rem; }
.pl-10 { padding-left: 2.5rem; }
.pt-0 { padding-top: 0; }
.pt-2 { padding-top: 0.5rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }

/* ── Typography ──────────────────────────────── */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: "Courier New", monospace; }
.leading-6 { line-height: 1.5rem; }
.leading-tight { line-height: 1.25; }
.tracking-wider { letter-spacing: 0.05em; }
.uppercase { text-transform: uppercase; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-inherit { color: inherit; }
.whitespace-nowrap { white-space: nowrap; }
.transition-colors { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }

/* ── Display / Position ──────────────────────── */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.sticky { position: sticky; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.select-none { user-select: none; }
.overflow-x-auto { overflow-x: auto; }
.top-24 { top: 6rem; }
.align-middle { vertical-align: middle; }

/* ── Borders / Radius ────────────────────────── */
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.list-disc { list-style-type: disc; }
.list-decimal { list-style-type: decimal; }
.list-none { list-style: none; }

/* ── Misc ────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.no-underline { text-decoration: none; }

/* ── Static Colors ───────────────────────────── */
.text-slate-100 { color: #f1f5f9; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-slate-900 { color: #0f172a; }
.text-slate-950 { color: #020617; }
.text-rose-500 { color: #f43f5e; }
.text-rose-600 { color: #e11d48; }
.text-amber-500 { color: #f59e0b; }
.text-emerald-500 { color: #10b981; }
.text-emerald-600 { color: #059669; }
.bg-slate-950 { background-color: #020617; }
.border-slate-200 { border-color: #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }
.border-slate-800 { border-color: #1e293b; }
.border-rose-500 { border-color: #f43f5e; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }


/* ── CSS variable utilities ──────────────────── */
.text-default { color: var(--text); }
.text-muted { color: var(--muted); }
.text-muted-soft { color: var(--muted-soft); }
.text-accent { color: var(--accent); }
.text-accent-hover { color: var(--accent-hover); }
.bg-surface { background-color: var(--surface); }
.bg-surface-soft { background-color: var(--surface-soft); }
.bg-surface-strong { background-color: var(--surface-strong); }
.border-default { border-color: var(--border); }

/* ── Hover states ────────────────────────────── */
.hover-border-strong:hover { border-color: var(--border-strong); }

/* ── Focus states ────────────────────────────── */
.focus-ring-accent:focus {
  --tw-ring-color: var(--accent);
  box-shadow: 0 0 0 calc(2px) var(--tw-ring-color);
}

/* ── Grid: semantic names ────────────────────── */
.lg-grid-part-fields { grid-template-columns: 1fr 1fr 7rem 7rem; }
.md-grid-part-meta { grid-template-columns: 8rem 8rem 1fr; }
.xl-grid-user-fields { grid-template-columns: 1fr 1fr 1fr 9rem auto; }

/* ── Responsive: xs (480px max) ──────────────── */
@media (max-width: 480px) {
  .xs\:hidden { display: none !important; }
  .xs\:block { display: block; }
  .xs\:flex { display: flex; }
  .xs\:flex-col { flex-direction: column; }
  .xs\:w-full { width: 100%; }
  .xs\:gap-1 { gap: 0.25rem; }
  .xs\:gap-0\.5 { gap: 0.125rem; }
  .xs\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .xs\:text-xs { font-size: 0.75rem; line-height: 1rem; }
  .xs\:px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
  .xs\:py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .xs\:overflow-x-auto { overflow-x: auto; }
}

/* ── Responsive: sm (640px+) ─────────────────── */
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none !important; }
  .sm\:inline { display: inline; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:w-auto { width: auto; }
  .sm\:items-center { align-items: center; }
  .sm\:items-start { align-items: flex-start; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:justify-end { justify-content: flex-end; }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* ── Responsive: md (768px+) ─────────────────── */
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .md\:hidden { display: none !important; }
  .md\:inline-flex { display: inline-flex; }
  .md\:flex-row { flex-direction: row; }
  .md\:w-auto { width: auto; }
  .md\:gap-2 { gap: 0.5rem; }
  .md\:items-center { align-items: center; }
}

/* ── Responsive: md (max 767px) ──────────────── */
@media (max-width: 767px) {
  .mdmax\:flex-col { flex-direction: column; }
  .mdmax\:w-full { width: 100%; }
  .mdmax\:gap-1 { gap: 0.25rem; }
  .mdmax\:items-stretch { align-items: stretch; }
}

/* ── Responsive: lg (1024px+) ────────────────── */
@media (min-width: 1024px) {
  .lg\:block { display: block; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:hidden { display: none; }
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
  .lg\:sticky { position: sticky; }
  .lg\:top-24 { top: 6rem; }
  .lg-grid-list-sidebar { grid-template-columns: 18rem 1fr; }
  .lg-grid-form-sidebar { grid-template-columns: minmax(0, 1fr) 22rem; }
}

/* ── Responsive: xl (1280px+) ────────────────── */
@media (min-width: 1280px) {
  .xl\:items-end { align-items: flex-end; }
}

/* ── Dark mode: static colors ────────────────── */
.dark .dark\:border-slate-600 { border-color: #475569; }
.dark .dark\:border-slate-800 { border-color: #1e293b; }
.dark .dark\:text-slate-300 { color: #cbd5e1; }
.dark .dark\:text-slate-400 { color: #94a3b8; }
.dark .dark\:text-slate-500 { color: #64748b; }
.dark .dark\:text-white { color: #fff; }
.dark .dark\:text-emerald-400 { color: #34d399; }
.dark .dark\:text-rose-300 { color: #fda4af; }

/* ── Mobile menu ──────────────────────────────── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.mobile-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
body.mobile-menu-open {
  overflow: hidden;
}
.mobile-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80%;
  max-width: 20rem;
  z-index: 50;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
}
.mobile-menu-panel.open {
  transform: translateX(0);
}

/* ── Responsive data-table → card view ─────────── */
@media (max-width: 640px) {
  .table-shell { overflow-x: visible; }
  .data-table-card thead { display: none; }
  .data-table-card tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    overflow: hidden;
  }
  .data-table-card td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    border-right: none;
    font-size: 0.8125rem;
    gap: 0.5rem;
    min-height: 2.5rem;
  }
  .data-table-card td:last-child {
    border-bottom: none;
  }
  .data-table-card td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    flex-shrink: 0;
    min-width: 30%;
  }
  .data-table-card td > *:not(.btn) {
    text-align: right;
  }
  .log-context-row { display: none; }
}

/* ── Mobile actions dropdown ──────────────────── */
.mobile-actions-dropdown {
  position: relative;
}
.mobile-actions-dropdown summary {
  list-style: none;
  cursor: pointer;
}
.mobile-actions-dropdown summary::-webkit-details-marker {
  display: none;
}
.mobile-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 30;
  min-width: 12rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
.mobile-action-link {
  display: block;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.mobile-action-link:last-child {
  border-bottom: none;
}
.mobile-action-link:hover {
  background: var(--surface-soft);
}
.mobile-action-link-primary {
  font-weight: 600;
  color: var(--accent);
}

/* ── Touch targets (coarse pointer) ──────────── */
@media (pointer: coarse) {
  .touch-target {
    min-height: 2.75rem;
    min-width: 2.75rem;
  }
}

/* ── State variants (hover, focus, etc.) ──────── */
.hover\:bg-accent:hover { background-color: var(--accent); }
.hover\:bg-surface-soft:hover { background-color: var(--surface-soft); }
.hover\:text-accent:hover { color: var(--accent); }
.hover\:text-accent-hover:hover { color: var(--accent-hover); }
.hover\:text-default:hover { color: var(--text); }
.hover\:border-accent-hover:hover { border-color: var(--accent-hover); }
.focus\:ring-accent:focus { outline: none; box-shadow: 0 0 0 3px var(--accent); }

/* ── Print ────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; color: #111827 !important; }
}
