:root {
  --bg: #edf2f0;
  --bg-accent: #d8e4de;
  --surface: #f7faf8;
  --ink: #16302b;
  --muted: #5b726c;
  --brand: #0f6b5c;
  --brand-dark: #0a4d42;
  --brand-soft: #c6e3dc;
  --line: #c9d7d2;
  --danger: #9b2c2c;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(15, 48, 42, 0.08);
  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Source Sans 3", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.app-body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #cfe7e1 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #e7efe4 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  font-family: var(--font-en);
}

html[lang="ar"] body.app-body {
  font-family: var(--font-ar);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(15, 107, 92, 0.94);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  min-height: 64px;
  display: flex;
  align-items: center;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.brand:hover {
  color: #e8f6f2;
  opacity: 0.95;
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(120px, 36vw);
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px 8px;
}

.user-chip {
  font-size: 0.9rem;
  opacity: 0.9;
}

.lang-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 2px;
}

.lang-btn {
  color: #dff3ee;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
}

.lang-btn.active,
.lang-btn:hover {
  background: #fff;
  color: var(--brand-dark);
}

.app-main {
  min-height: calc(100vh - 64px);
}

.auth-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 1rem 0 2rem;
}

.auth-card {
  width: min(100%, 440px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-logo {
  display: block;
  width: min(100%, 220px);
  height: auto;
  object-fit: contain;
}

.auth-title {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.auth-subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.form-label {
  font-weight: 600;
  color: var(--ink);
}

.form-control,
.form-control:focus {
  border-color: var(--line);
  border-radius: 10px;
}

.form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(15, 107, 92, 0.18);
  border-color: var(--brand);
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  border-radius: 10px;
  font-weight: 600;
}

.btn-outline-light {
  border-radius: 10px;
}

.portal-page {
  max-width: 1100px;
}

.portal-hero {
  margin-bottom: 1.5rem;
}

.portal-kicker {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.portal-hero h1 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  margin-bottom: 0.5rem;
}

.portal-lead,
.portal-note,
.muted {
  color: var(--muted);
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.info-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.info-panel h2 {
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
}

.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.plain-list li + li {
  margin-top: 0.45rem;
}

.plain-list.compact li {
  font-size: 0.92rem;
}

.plain-list code {
  background: #e8f1ee;
  color: var(--brand-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.admin-layout {
  /* Legacy alias — admin now uses .portal-shell */
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.admin-nav {
  width: 260px;
  flex-shrink: 0;
  order: 2;
  position: sticky;
  top: 84px;
  background:
    linear-gradient(165deg, #f7fbf9 0%, #eef6f3 55%, #e7f1ee 100%);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1rem 1rem;
  box-shadow: var(--shadow);
}

html[dir="rtl"] .admin-content {
  order: 2;
}

html[dir="rtl"] .admin-nav {
  order: 1;
}

.admin-content {
  flex: 1;
  min-width: 0;
  order: 1;
}

.admin-nav-title {
  margin: 0 0 0.9rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(15, 107, 92, 0.12);
  font-weight: 700;
  color: var(--brand-dark);
}

.admin-nav nav {
  display: grid;
  gap: 0.35rem;
}

.admin-nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 0 rgba(15, 48, 42, 0.06);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.2rem 1.25rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(15, 107, 92, 0.14);
  background:
    radial-gradient(680px 200px at 0% 0%, rgba(61, 155, 138, 0.18), transparent 60%),
    linear-gradient(135deg, #f8fcfb 0%, #eef5f2 100%);
  box-shadow: var(--shadow);
}

.page-header h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
}

.page-header .muted {
  margin-bottom: 0;
}

.page-header .actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.filter-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  align-items: center;
}

.filter-bar-inventory {
  grid-template-columns: 1.6fr repeat(5, minmax(0, 1fr)) auto;
}

@media (max-width: 1200px) {
  .filter-bar-inventory {
    grid-template-columns: 1fr 1fr;
  }
}

.assignment-form .form-grid {
  margin-bottom: 0.75rem;
}

.location-tree-panel {
  max-width: 1100px;
}

.location-node {
  margin-inline-start: calc(var(--depth, 0) * 1.1rem);
}

.location-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f8f6;
  margin-bottom: 0.45rem;
}

.location-row.is-inactive {
  opacity: 0.7;
}

.location-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

@media (max-width: 900px) {
  .location-row {
    flex-direction: column;
    align-items: stretch;
  }

  .location-row .actions-cell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    width: 100%;
  }

  .location-row .actions-cell .btn,
  .location-row .actions-cell form {
    width: 100%;
  }

  .location-row .actions-cell .btn {
    min-width: 0;
  }
}

/* Shared portal shell (client / employee / manager) */
.portal-shell {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.portal-main {
  flex: 1;
  min-width: 0;
  order: 1;
}

.portal-sidebar {
  width: 260px;
  flex-shrink: 0;
  order: 2;
  position: sticky;
  top: 84px;
  background:
    linear-gradient(165deg, #f7fbf9 0%, #eef6f3 55%, #e7f1ee 100%);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1rem 1rem;
  box-shadow: var(--shadow);
}

html[dir="rtl"] .portal-main {
  order: 2;
}

html[dir="rtl"] .portal-sidebar {
  order: 1;
}

.portal-sidebar-brand {
  margin-bottom: 0.9rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(15, 107, 92, 0.12);
}

.portal-sidebar-title {
  margin: 0;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 0.01em;
}

.portal-sidebar-project {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.portal-nav {
  display: grid;
  gap: 0.35rem;
}

.portal-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.portal-nav a:hover,
.portal-nav a.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 0 rgba(15, 48, 42, 0.06);
}

@media (max-width: 900px) {
  .portal-shell {
    flex-direction: column;
  }

  .portal-sidebar,
  html[dir="rtl"] .portal-sidebar {
    order: -1;
    position: static;
    width: 100%;
  }

  .portal-main,
  html[dir="rtl"] .portal-main {
    order: 2;
  }

  .portal-nav {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .admin-layout {
    flex-direction: column;
  }

  .admin-nav,
  html[dir="rtl"] .admin-nav {
    order: -1;
    position: static;
    width: 100%;
  }

  .admin-content,
  html[dir="rtl"] .admin-content {
    order: 2;
  }

  .admin-nav nav {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .actions-cell,
  .page-header > .btn,
  .page-header > a.btn {
    width: 100%;
  }

  .table-wrap,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-header .container-fluid {
    padding-inline: 0.75rem;
  }

  .brand-logo {
    height: 34px;
    max-width: min(100px, 34vw);
    padding: 3px 6px;
  }

  .header-actions {
    gap: 0.35rem !important;
  }

  .header-actions .btn {
    padding-inline: 0.55rem;
  }
}

/* Legacy aliases kept for any leftover markup */
.employee-shell,
.client-layout,
.manager-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.employee-content,
.client-main,
.manager-main {
  flex: 1;
  min-width: 0;
  order: 1;
}

.employee-nav,
.client-sidebar,
.manager-sidebar {
  width: 260px;
  flex-shrink: 0;
  order: 2;
  position: sticky;
  top: 84px;
  background:
    linear-gradient(165deg, #f7fbf9 0%, #eef6f3 55%, #e7f1ee 100%);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1rem 1rem;
  box-shadow: var(--shadow);
  color: inherit;
}

html[dir="rtl"] .employee-content,
html[dir="rtl"] .client-main,
html[dir="rtl"] .manager-main {
  order: 2;
}

html[dir="rtl"] .employee-nav,
html[dir="rtl"] .client-sidebar,
html[dir="rtl"] .manager-sidebar {
  order: 1;
}

.client-sidebar-title,
.manager-sidebar-title {
  margin: 0;
  font-weight: 700;
  color: var(--brand-dark);
}

.client-sidebar-project,
.manager-sidebar-project {
  margin: 0.35rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.manager-sidebar-brand {
  margin-bottom: 0.9rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(15, 107, 92, 0.12);
}

.employee-nav,
.client-sidebar nav,
.manager-nav {
  display: grid;
  gap: 0.35rem;
}

.employee-nav a,
.client-sidebar nav a,
.manager-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  text-align: start;
}

.employee-nav a.active,
.employee-nav a:hover,
.client-sidebar nav a.active,
.client-sidebar nav a:hover,
.manager-nav a.active,
.manager-nav a:hover {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 0 rgba(15, 48, 42, 0.06);
}

@media (max-width: 900px) {
  .employee-shell,
  .client-layout,
  .manager-layout {
    flex-direction: column;
  }

  .employee-nav,
  .client-sidebar,
  .manager-sidebar,
  html[dir="rtl"] .employee-nav,
  html[dir="rtl"] .client-sidebar,
  html[dir="rtl"] .manager-sidebar {
    order: -1;
    position: static;
    width: 100%;
  }

  .employee-content,
  .client-main,
  .manager-main,
  html[dir="rtl"] .employee-content,
  html[dir="rtl"] .client-main,
  html[dir="rtl"] .manager-main {
    order: 2;
  }

  .employee-nav,
  .client-sidebar nav,
  .manager-nav {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

/* Client dashboard */
.cdash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 1.1rem;
  align-items: stretch;
  margin-bottom: 1.15rem;
  padding: 1.35rem 1.4rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(15, 107, 92, 0.14);
  background:
    radial-gradient(700px 220px at 0% 0%, rgba(61, 155, 138, 0.22), transparent 60%),
    radial-gradient(520px 200px at 100% 10%, rgba(31, 58, 95, 0.12), transparent 55%),
    linear-gradient(135deg, #f8fcfb 0%, #e9f4f0 100%);
  box-shadow: var(--shadow);
}

.cdash-kicker {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 107, 92, 0.12);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.cdash-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
}

.cdash-lead {
  margin: 0;
  font-weight: 600;
  color: var(--brand-dark);
}

.cdash-desc {
  margin: 0.55rem 0 0;
  color: var(--muted);
  max-width: 42rem;
}

.cdash-progress-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 107, 92, 0.12);
}

.cdash-ring {
  --pct: 0;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--brand) calc(var(--pct) * 1%), #d7e6e1 0);
  display: grid;
  place-items: center;
}

.cdash-ring-inner {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.15;
}

.cdash-ring-inner strong {
  font-size: 1.25rem;
  color: var(--brand-dark);
}

.cdash-ring-inner span {
  font-size: 0.68rem;
  color: var(--muted);
  max-width: 4.8rem;
}

.cdash-progress-meta {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.cdash-progress-meta p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cdash-progress-meta strong {
  font-size: 1.05rem;
  color: var(--ink);
}

.cdash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.cdash-stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.95rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}

.cdash-stat-icon {
  position: absolute;
  inset-inline-end: 0.85rem;
  top: 0.75rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  background: rgba(15, 107, 92, 0.1);
  color: var(--brand-dark);
  opacity: 0.9;
}

.cdash-stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding-inline-end: 2rem;
}

.cdash-stat-value {
  margin: 0.4rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.cdash-stat--teal { border-top-color: #0f6b5c; }
.cdash-stat--teal .cdash-stat-icon { background: rgba(15, 107, 92, 0.12); color: #0a4d42; }
.cdash-stat--navy { border-top-color: #1f3a5f; }
.cdash-stat--navy .cdash-stat-icon { background: rgba(31, 58, 95, 0.12); color: #1f3a5f; }
.cdash-stat--amber { border-top-color: #c9852c; }
.cdash-stat--amber .cdash-stat-icon { background: rgba(201, 133, 44, 0.14); color: #8a5a14; }
.cdash-stat--sky { border-top-color: #2f7f9e; }
.cdash-stat--sky .cdash-stat-icon { background: rgba(47, 127, 158, 0.12); color: #1f5f78; }
.cdash-stat--mint { border-top-color: #3d9b8a; }
.cdash-stat--mint .cdash-stat-icon { background: rgba(61, 155, 138, 0.14); color: #1f6d5f; }
.cdash-stat--violet { border-top-color: #5b6b9a; }
.cdash-stat--violet .cdash-stat-icon { background: rgba(91, 107, 154, 0.14); color: #3f4d75; }
.cdash-stat--slate { border-top-color: #60756f; }
.cdash-stat--slate .cdash-stat-icon { background: rgba(96, 117, 111, 0.14); color: #405550; }
.cdash-stat--rose { border-top-color: #b35c5c; }
.cdash-stat--rose .cdash-stat-icon { background: rgba(179, 92, 92, 0.14); color: #8a3d3d; }

.cdash-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.cdash-lower {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.cdash-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1.15rem 1.15rem;
  box-shadow: var(--shadow);
  min-width: 0;
}

.cdash-panel--wide {
  min-height: 100%;
}

.cdash-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.cdash-panel-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.cdash-chart-wrap {
  position: relative;
  height: 240px;
}

.cdash-chart-wrap--donut {
  height: 210px;
  max-width: 240px;
  margin-inline: auto;
}

.cdash-legend {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.cdash-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.cdash-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.cdash-dot--completed { background: #0f6b5c; }
.cdash-dot--draft { background: #c9852c; }
.cdash-dot--images { background: #2f7f9e; }

.cdash-people,
.cdash-activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.cdash-person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: #f3f8f6;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cdash-person:hover {
  background: #eaf4f0;
  border-color: rgba(15, 107, 92, 0.18);
}

.cdash-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f6b5c, #1f3a5f);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.cdash-person-meta {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.cdash-person-meta strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cdash-person-count {
  font-weight: 700;
  color: var(--brand-dark);
  background: #fff;
  border-radius: 999px;
  min-width: 2rem;
  text-align: center;
  padding: 0.2rem 0.45rem;
  font-size: 0.85rem;
}

.cdash-activity a {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid #e4eeea;
}

.cdash-activity li:last-child a {
  border-bottom: 0;
}

.cdash-activity a:hover .cdash-activity-id {
  color: var(--brand-dark);
}

.cdash-activity-id {
  font-weight: 700;
  color: var(--ink);
}

.cdash-activity .muted {
  text-align: end;
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .cdash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cdash-lower {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .cdash-hero,
  .cdash-charts {
    grid-template-columns: 1fr;
  }

  .cdash-progress-card {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .cdash-stats {
    grid-template-columns: 1fr;
  }

  .cdash-activity a {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "id status"
      "date date";
  }

  .cdash-activity-id { grid-area: id; }
  .cdash-activity .status-pill { grid-area: status; }
  .cdash-activity .muted {
    grid-area: date;
    text-align: start;
  }
}

/* Client assets */
.cassets-workspace {
  display: grid;
  gap: 1rem;
}

.cassets-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(15, 107, 92, 0.14);
  background:
    radial-gradient(640px 200px at 100% 0%, rgba(31, 58, 95, 0.1), transparent 55%),
    linear-gradient(135deg, #f8fcfb 0%, #eaf4f0 100%);
  box-shadow: var(--shadow);
}

.cassets-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
}

.cassets-desc {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 40rem;
}

.cassets-hero-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
}

.cassets-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.cassets-summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}

.cassets-summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.cassets-summary-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--ink);
  font-weight: 700;
}

.cassets-summary-card--teal { border-top-color: #0f6b5c; }
.cassets-summary-card--navy { border-top-color: #1f3a5f; }
.cassets-summary-card--amber { border-top-color: #c9852c; }
.cassets-summary-card--sky { border-top-color: #2f7f9e; }
.cassets-summary-card--rose { border-top-color: #b35c5c; }
.cassets-summary-card--violet { border-top-color: #5b6b9a; }
.cassets-summary-card--slate { border-top-color: #60756f; }

.creports-filter-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(120px, 1fr)) repeat(2, minmax(130px, 1fr)) auto;
  gap: 0.65rem;
  align-items: center;
}

@media (max-width: 1100px) {
  .creports-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .creports-filter-grid {
    grid-template-columns: 1fr;
  }
}

.cassets-filter-panel {
  padding: 1rem 1.1rem;
}

.cassets-filter-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(140px, 1fr)) auto;
  gap: 0.65rem;
  align-items: center;
}

.cassets-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.cassets-table-panel {
  padding: 0;
  overflow: hidden;
}

.cassets-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.cassets-table-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.cassets-table {
  min-width: 780px;
}

.cassets-table thead th {
  background: #eef5f2;
}

.cassets-id {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cassets-summary-link {
  color: inherit;
  text-decoration: none;
}

.cassets-summary-link:hover strong {
  color: var(--brand);
}

.cassets-person-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.cassets-mini-avatar {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, #0f6b5c, #1f3a5f);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

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

.cassets-empty {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.cassets-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 1rem;
}

.cassets-fields {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.cassets-field {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.4fr);
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #f3f8f6;
  border: 1px solid transparent;
}

.cassets-field dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
}

.cassets-field dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.cassets-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.cassets-meta-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #f3f8f6;
}

.cassets-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.cassets-image-card {
  display: block;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #eef5f2;
  aspect-ratio: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cassets-image-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 48, 42, 0.12);
}

.cassets-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cassets-image-card-wrap {
  display: grid;
  gap: 0.35rem;
}

@media (max-width: 1100px) {
  .cassets-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cassets-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .cassets-hero {
    flex-direction: column;
  }

  .cassets-hero-side {
    justify-content: flex-start;
  }

  .cassets-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .cassets-summary {
    grid-template-columns: 1fr 1fr;
  }

  .cassets-filter-grid {
    grid-template-columns: 1fr;
  }

  .cassets-field {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* Client employees */
.cemps-workspace {
  display: grid;
  gap: 1rem;
}

.cemps-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.cemps-panel {
  padding: 0;
  overflow: hidden;
}

.cemps-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.cemps-panel-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.cemps-search {
  margin: 0;
  min-width: min(240px, 100%);
}

.cemps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  padding: 1rem 1.1rem 1.15rem;
}

.cemps-card {
  display: grid;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(165deg, #ffffff 0%, #f4f9f7 100%);
  box-shadow: 0 8px 20px rgba(15, 48, 42, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cemps-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 107, 92, 0.28);
  box-shadow: 0 14px 28px rgba(15, 48, 42, 0.1);
}

.cemps-card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.cemps-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, #0f6b5c, #1f3a5f);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.cemps-avatar--lg {
  width: 3.25rem;
  height: 3.25rem;
  font-size: 1.2rem;
}

.cemps-card-meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

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

.cemps-count {
  min-width: 2.1rem;
  text-align: center;
  font-weight: 700;
  color: var(--brand-dark);
  background: #e7f3ef;
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
}

.cemps-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2ece8;
  overflow: hidden;
}

.cemps-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f6b5c, #3d9b8a);
}

.cemps-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.cemps-link {
  color: var(--brand-dark);
}

.cemps-card--manager {
  padding: 0;
  overflow: hidden;
}

.cemps-card-link {
  display: grid;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
  padding: 0.95rem 1rem 0.7rem;
}

.cemps-card-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0 1rem 0.95rem;
}

.cemps-empty,
.cemps-empty-filter {
  padding: 1.5rem 1.1rem;
  text-align: center;
}

.cemps-detail-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.cemps-detail-title h1 {
  margin: 0 0 0.35rem;
}

.cemps-detail-title .cassets-desc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

@media (max-width: 900px) {
  .cemps-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cemps-panel-head {
    flex-direction: column;
  }

  .cemps-search {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .cemps-summary {
    grid-template-columns: 1fr;
  }
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  white-space: nowrap;
}

.emp-hero {
  margin-bottom: 1.25rem;
}

.emp-card-list {
  display: grid;
  gap: 0.65rem;
}

.emp-card {
  display: grid;
  gap: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.emp-card:hover {
  border-color: var(--brand);
}

.emp-actions,
.emp-form-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.emp-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.scanner-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 28, 24, 0.72);
  display: grid;
  place-items: center;
  z-index: 2000;
  padding: 1rem;
}

.scanner-modal[hidden] {
  display: none !important;
}

.scanner-panel {
  width: min(100%, 420px);
  background: #fff;
  border-radius: 14px;
  padding: 0.85rem;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.capture-actions {
  display: grid;
  gap: 0.55rem;
}

.capture-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.capture-preview-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef5f2;
}

.capture-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.capture-preview-remove {
  position: absolute;
  top: 0.3rem;
  inset-inline-end: 0.3rem;
  width: 1.7rem;
  height: 1.7rem;
  border: none;
  border-radius: 999px;
  background: rgba(15, 48, 42, 0.78);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.capture-preview-remove:hover {
  background: var(--danger);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.image-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
  box-shadow: var(--shadow);
}

.image-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 0.45rem;
}

.image-meta {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .location-row {
    flex-direction: column;
  }
}


.table-panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.form-panel {
  max-width: 920px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
}

.check-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  background: #eef5f2;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  margin: 0;
}

.tag {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0.1rem;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-active {
  background: #d9f2e5;
  color: #146c43;
}

.status-inactive {
  background: #f8d7da;
  color: #842029;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin: 0.25rem 0 0.85rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card .stat-number {
  margin: 0.35rem 0 0;
  font-size: 1.7rem;
}

.stat-text {
  margin: 0.45rem 0 0;
  font-weight: 600;
  color: var(--brand-dark);
}

/* Admin dashboard */
.adash-workspace {
  display: grid;
  gap: 1.1rem;
}

.adash-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.4rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(15, 107, 92, 0.14);
  background:
    radial-gradient(700px 220px at 0% 0%, rgba(61, 155, 138, 0.22), transparent 60%),
    radial-gradient(520px 200px at 100% 10%, rgba(31, 58, 95, 0.12), transparent 55%),
    linear-gradient(135deg, #f8fcfb 0%, #e9f4f0 100%);
  box-shadow: var(--shadow);
}

.adash-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.adash-lead {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.adash-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.adash-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.adash-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}

.adash-stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.adash-stat-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.65rem;
  line-height: 1.1;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.adash-stat--teal { border-top-color: #0f6b5c; }
.adash-stat--navy { border-top-color: #1f3a5f; }
.adash-stat--mint { border-top-color: #3d9b8a; }
.adash-stat--sky { border-top-color: #2f7f9e; }
.adash-stat--amber { border-top-color: #c9852c; }
.adash-stat--violet { border-top-color: #5b6b9a; }
.adash-stat--gold { border-top-color: #b8872d; }
.adash-stat--rose { border-top-color: #b35c5c; }
.adash-stat--slate { border-top-color: #60756f; }
.adash-stat--ink { border-top-color: #16302b; }

.adash-stat--mobile-only,
.adash-cards-mobile {
  display: none;
}

.adash-secondary-stats {
  display: none;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.adash-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #f3f8f6;
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.adash-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  gap: 1rem;
}

.adash-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 1rem;
}

.adash-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  min-width: 0;
}

.adash-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.adash-panel-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.adash-chart-wrap {
  position: relative;
  height: 260px;
}

.adash-progress {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.adash-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.adash-progress-head a {
  color: inherit;
  text-decoration: none;
}

.adash-progress-head a:hover {
  color: var(--brand-dark);
}

.adash-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2ece8;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.adash-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f6b5c, #3d9b8a);
}

.adash-table thead th {
  background: #eef5f2;
}

.adash-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.adash-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, #0f6b5c, #1f3a5f);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.adash-activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.adash-activity a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  text-decoration: none;
  color: inherit;
  padding: 0.6rem 0.35rem;
  border-bottom: 1px solid #e4eeea;
}

.adash-activity li:last-child a {
  border-bottom: 0;
}

.adash-activity-id {
  font-weight: 700;
  color: var(--brand-dark);
}

.adash-activity-meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.adash-cards-mobile {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  gap: 0.55rem;
}

.adash-cards-mobile li {
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  background: #f3f8f6;
  border: 1px solid transparent;
}

.adash-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Desktop-first: keep dense grid on large screens */
@media (min-width: 1101px) {
  .adash-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .adash-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .adash-charts,
  .adash-lower {
    grid-template-columns: 1fr;
  }
}

/* Mobile layout — different composition from desktop */
@media (max-width: 900px) {
  .adash-hero {
    flex-direction: column;
    padding: 1.1rem 1rem;
  }

  .adash-hero-actions {
    width: 100%;
    justify-content: stretch;
  }

  .adash-hero-actions .btn {
    flex: 1;
  }

  .adash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .adash-stat {
    padding: 0.8rem 0.85rem;
  }

  .adash-stat-value {
    font-size: 1.4rem;
  }

  .adash-stat--desktop-only {
    display: none;
  }

  .adash-secondary-stats,
  .adash-stat--mobile-only {
    display: flex;
  }

  .adash-chart-wrap {
    height: 220px;
  }

  .adash-panel {
    padding: 0.95rem 0.9rem;
  }

  .adash-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .adash-panel-head .btn {
    width: 100%;
  }

  .adash-table-desktop {
    display: none;
  }

  .adash-cards-mobile {
    display: grid;
  }

  .adash-activity a {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media (max-width: 560px) {
  .adash-hero-actions {
    flex-direction: column;
  }

  .adash-hero-actions .btn {
    width: 100%;
  }
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  min-height: 160px;
  padding-top: 0.5rem;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  min-width: 0;
}

.bar-fill {
  width: 100%;
  max-width: 36px;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.bar-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.bar-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

.small-meta {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
}

.emp-stats {
  margin-top: 1rem;
}

.cards-stack {
  display: grid;
  gap: 0.85rem;
}

.role-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.permission-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

@media (max-width: 768px) {
  .auth-card {
    padding: 1.5rem 1.15rem;
  }

  .portal-grid,
  .form-grid,
  .filter-bar,
  .project-split,
  .inventory-layout,
  .inventory-summary,
  .perf-summary {
    grid-template-columns: 1fr;
  }

  .brand {
    font-size: 0.92rem;
  }

  .page-header {
    flex-direction: column;
  }

  .project-section-nav {
    overflow-x: auto;
  }

  .data-table {
    min-width: 640px;
  }

  .ui-table-desktop .data-table,
  .cassets-table-desktop .data-table,
  .inventory-table-desktop .data-table,
  .perf-table-desktop .data-table {
    min-width: 0;
  }

  .cassets-hero-side,
  .cassets-table-head,
  .inventory-table-head,
  .perf-table-head {
    flex-direction: column;
    align-items: stretch;
  }

  .cassets-hero-side .btn,
  .cassets-table-head .btn {
    width: 100%;
  }
}

.project-workspace {
  display: grid;
  gap: 1rem;
}

.project-workspace-header {
  margin-bottom: 0;
}

.project-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #eef5f2;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta-chip strong {
  color: var(--ink);
  font-weight: 700;
}

.project-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  position: sticky;
  top: 76px;
  z-index: 40;
  background: rgba(247, 250, 248, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem;
  box-shadow: var(--shadow);
}

.project-section-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
}

.project-section-nav a:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.project-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.project-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f3f8f6 0%, var(--surface) 100%);
}

.project-section-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
}

.project-section-head .muted {
  margin: 0;
  font-size: 0.9rem;
}

.project-section-body {
  padding: 1.15rem;
}

.project-section-actions {
  display: flex;
  justify-content: flex-start;
}

.project-split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.project-card {
  background: #f4f8f6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.project-card h3 {
  margin: 0 0 0.85rem;
  font-size: 0.98rem;
}

.project-card-table {
  padding: 0;
  overflow: hidden;
}

.project-card-table > h3 {
  margin: 0;
  padding: 0.95rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.project-card-table .table-responsive {
  padding: 0;
}

.project-card-table .table {
  margin: 0;
}

.project-card-table .table thead th {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: #eef5f2;
  border-bottom-color: var(--line);
  white-space: nowrap;
  padding: 0.7rem 0.9rem;
}

.project-card-table .table tbody td {
  padding: 0.85rem 0.9rem;
  border-bottom-color: var(--line);
  vertical-align: middle;
}

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

.assignments-table .assignment-user {
  display: grid;
  gap: 0.15rem;
  min-width: 140px;
}

.assignments-table .assignment-user strong {
  font-weight: 700;
  color: var(--ink);
}

.assignments-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: end;
}

.assignment-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.assignment-actions form {
  margin: 0;
  display: inline-flex;
}

.assignment-actions .btn {
  min-width: 4.75rem;
  white-space: nowrap;
}

.project-workspace .form-panel {
  max-width: none;
}

.project-section .location-tree-panel {
  padding-top: 0.25rem;
}

.location-composer {
  margin-bottom: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(15, 107, 92, 0.16);
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(520px 160px at 0% 0%, rgba(61, 155, 138, 0.14), transparent 60%),
    linear-gradient(180deg, #f8fcfb 0%, #f3f8f6 100%);
  box-shadow: var(--shadow);
}

.location-composer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.location-composer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.location-floors-block {
  margin-bottom: 0.85rem;
}

.location-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.floors-list {
  display: grid;
  gap: 0.45rem;
}

.floor-row .input-group {
  gap: 0.35rem;
}

.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.location-actions form {
  margin: 0;
}

@media (max-width: 900px) {
  .location-composer-grid {
    grid-template-columns: 1fr;
  }

  .location-composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .location-composer-actions .btn {
    width: 100%;
  }
}

/* Templates */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  text-align: start;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.85rem;
  white-space: nowrap;
  background: #f7faf8;
}

.data-table tbody td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td {
  background: #f9fcfb;
}

.template-workspace {
  display: grid;
  gap: 1rem;
}

.template-workspace .page-header {
  align-items: flex-start;
}

.template-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.55rem;
}

.template-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
}

.template-toolbar form,
.template-actions form {
  margin: 0;
  display: inline-flex;
}

.template-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.template-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.template-fields-panel,
.template-list-panel {
  padding: 1rem 1.1rem 0.35rem;
}

.template-table .col-order {
  width: 3rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.template-code,
.field-key {
  background: #eef3f1;
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  font-size: 0.82rem;
}

.field-label-cell {
  display: grid;
  gap: 0.2rem;
}

.field-label-cell .field-key {
  width: fit-content;
}

.flags-cell {
  max-width: 220px;
}

.version-meta {
  display: inline-block;
  margin-inline-end: 0.35rem;
  font-weight: 700;
}

.status-draft {
  background: #fff3cd;
  color: #664d03;
}

.status-published {
  background: #d9f2e5;
  color: #146c43;
}

.status-archived {
  background: #e9ecef;
  color: #495057;
}

.template-notes {
  margin: 0;
}

.template-actions {
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .template-workspace .page-header {
    flex-direction: column;
  }

  .template-toolbar {
    justify-content: flex-start;
    width: 100%;
  }
}

.flash-stack {
  position: fixed;
  top: 76px;
  inset-inline-end: 1rem;
  z-index: 1080;
  width: min(420px, calc(100vw - 2rem));
  margin: 0;
  pointer-events: none;
}

.flash-stack .alert {
  pointer-events: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 0.55rem;
  animation: flash-in 0.22s ease;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.project-section {
  scroll-margin-top: 140px;
}

.app-confirm-modal .modal-content {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--ink);
}

.app-confirm-modal .modal-header {
  border-bottom-color: var(--line);
}

.app-confirm-modal .modal-footer {
  border-top-color: var(--line);
  gap: 0.5rem;
}

.app-confirm-modal .modal-title {
  font-weight: 700;
}

.app-confirm-modal .modal-body {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.app-confirm-modal .modal-body p {
  white-space: pre-line;
}

/* Inventory staff performance */
.perf-workspace {
  display: grid;
  gap: 1rem;
}

.perf-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.perf-summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.perf-summary-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.perf-summary-value {
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--brand-dark);
  font-weight: 700;
}

.perf-table-panel {
  padding: 0;
  overflow: hidden;
}

.perf-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.perf-table-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.perf-table {
  min-width: 920px;
}

.perf-table thead th {
  background: #eef5f2;
}

.perf-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 180px;
}

.perf-user-lg {
  align-items: flex-start;
}

.perf-user-lg .perf-avatar {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.05rem;
  margin-top: 0.15rem;
}

.perf-avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  flex-shrink: 0;
}

.perf-user-name {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.perf-user-name:hover {
  color: var(--brand);
}

.perf-metric {
  display: inline-block;
  min-width: 1.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.perf-metric-strong {
  color: var(--brand-dark);
  font-weight: 700;
}

.perf-project {
  font-weight: 600;
  max-width: 180px;
}

.perf-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

.status-idle {
  background: #eef1f0;
  color: #5b726c;
}

@media (max-width: 1100px) {
  .perf-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .perf-summary {
    grid-template-columns: 1fr;
  }

  .perf-table-head {
    flex-direction: column;
  }
}

/* Inventory list */
.inventory-workspace {
  display: grid;
  gap: 1rem;
}

.inventory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.inventory-summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.inventory-summary-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.inventory-summary-value {
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--brand-dark);
  font-weight: 700;
}

.inventory-filter-panel {
  padding: 1rem;
}

.inventory-filter-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(5, minmax(140px, 1fr)) auto;
  gap: 0.65rem;
  align-items: center;
}

.inventory-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.inventory-quick-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.inventory-chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  background: #eef5f2;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.inventory-chip:hover,
.inventory-chip.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}

.inventory-chip-reset {
  background: #fff;
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}

.inventory-table-panel {
  padding: 0;
  overflow: hidden;
}

.inventory-table-head,
.inventory-side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.inventory-table-head h2,
.inventory-side-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.inventory-table {
  min-width: 860px;
}

.inventory-table thead th {
  background: #eef5f2;
}

.inventory-id {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.inventory-summary-link {
  color: inherit;
  text-decoration: none;
}

.inventory-summary-link:hover strong {
  color: var(--brand);
}

.inventory-image-count {
  display: inline-flex;
  min-width: 1.8rem;
  justify-content: center;
  font-weight: 600;
  color: var(--muted);
}

.inventory-image-count.has-images {
  color: var(--brand-dark);
}

.inventory-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: end;
}

.inventory-actions {
  display: inline-flex;
  gap: 0.35rem;
  justify-content: flex-end;
}

.inventory-side-card {
  padding: 0;
  overflow: hidden;
}

.inventory-activity-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.inventory-activity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.inventory-activity-list li:last-child {
  border-bottom: none;
}

@media (max-width: 1200px) {
  .inventory-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .inventory-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .inventory-summary {
    grid-template-columns: 1fr;
  }

  .inventory-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Shared dual layout (desktop ≠ mobile)
   Use: .ui-page > .ui-hero + filters + .ui-table-desktop / .ui-cards-mobile
   ========================================================= */
.ui-page {
  display: grid;
  gap: 1.1rem;
}

.ui-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(15, 107, 92, 0.14);
  background:
    radial-gradient(700px 220px at 0% 0%, rgba(61, 155, 138, 0.2), transparent 60%),
    radial-gradient(480px 180px at 100% 0%, rgba(31, 58, 95, 0.1), transparent 55%),
    linear-gradient(135deg, #f8fcfb 0%, #e9f4f0 100%);
  box-shadow: var(--shadow);
}

.ui-hero h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.4rem, 2.5vw, 1.95rem);
}

.ui-hero-lead {
  margin: 0;
  color: var(--muted);
  max-width: 40rem;
}

.ui-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

.ui-kicker {
  display: inline-block;
  margin: 0 0 0.4rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 107, 92, 0.12);
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.ui-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.ui-summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}

.ui-summary-card--teal { border-top-color: #0f6b5c; }
.ui-summary-card--navy { border-top-color: #1f3a5f; }
.ui-summary-card--amber { border-top-color: #c9852c; }
.ui-summary-card--sky { border-top-color: #2f7f9e; }
.ui-summary-card--rose { border-top-color: #b35c5c; }
.ui-summary-card--mint { border-top-color: #3d9b8a; }
.ui-summary-card--violet { border-top-color: #5b6b9a; }

.ui-summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.ui-summary-value {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.ui-filter {
  padding: 0.95rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ui-filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(120px, 1fr)) auto;
  gap: 0.65rem;
  align-items: center;
}

.ui-filter-grid--2 {
  grid-template-columns: 2fr 1fr auto;
}

.ui-filter-grid--1 {
  grid-template-columns: 1fr auto;
}

.ui-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

.ui-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.ui-panel-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.ui-panel-body {
  padding: 1rem 1.1rem;
}

.ui-table-desktop {
  display: block;
}

.ui-cards-mobile {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0.65rem;
  gap: 0.55rem;
}

.ui-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: #f3f8f6;
  border: 1px solid transparent;
}

.ui-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.ui-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.ui-card-title:hover {
  color: var(--brand-dark);
}

.ui-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.ui-card-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.ui-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ui-card-actions .btn,
.ui-card-actions form {
  flex: 1 1 auto;
}

.ui-card-actions .btn {
  min-width: 0;
}

.ui-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.ui-avatar {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, #0f6b5c, #1f3a5f);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ui-desktop-only {
  display: initial;
}

.ui-mobile-only {
  display: none !important;
}

.ui-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr);
  gap: 1rem;
  align-items: start;
}

.ui-form {
  max-width: 920px;
}

.ui-form .form-grid {
  margin-bottom: 1rem;
}

/* Alias: inventory summary cards get color accents */
.inventory-summary-card {
  border-top: 3px solid #0f6b5c;
}

.inventory-summary-card:nth-child(2) { border-top-color: #1f3a5f; }
.inventory-summary-card:nth-child(3) { border-top-color: #c9852c; }
.inventory-summary-card:nth-child(4) { border-top-color: #2f7f9e; }

.perf-summary-card {
  border-top: 3px solid #0f6b5c;
}

.perf-summary-card:nth-child(2) { border-top-color: #1f3a5f; }
.perf-summary-card:nth-child(3) { border-top-color: #2f7f9e; }
.perf-summary-card:nth-child(4) { border-top-color: #c9852c; }
.perf-summary-card:nth-child(5) { border-top-color: #3d9b8a; }

@media (max-width: 1100px) {
  .ui-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ui-split {
    grid-template-columns: 1fr;
  }
}

/* Mobile composition — separate from desktop */
@media (max-width: 900px) {
  .ui-desktop-only,
  .ui-table-desktop {
    display: none !important;
  }

  .ui-mobile-only {
    display: block !important;
  }

  .ui-cards-mobile {
    display: grid !important;
  }

  .ui-hero,
  .page-header {
    flex-direction: column;
    padding: 1.05rem 1rem;
  }

  .ui-hero-actions,
  .page-header .actions-cell {
    width: 100%;
    justify-content: stretch;
  }

  .ui-hero-actions .btn,
  .page-header .actions-cell .btn,
  .page-header > .btn,
  .page-header > a.btn {
    flex: 1;
    width: 100%;
  }

  .ui-filter-grid,
  .ui-filter-grid--2,
  .ui-filter-grid--1,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .ui-filter-grid .btn,
  .filter-bar .btn {
    width: 100%;
  }

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

  .ui-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ui-panel-head .btn {
    width: 100%;
  }

  .role-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .role-card-head .actions-cell {
    width: 100%;
  }

  .role-card-head .actions-cell .btn {
    flex: 1;
  }

  /* Prefer cards over forced wide tables when dual markup exists */
  .ui-page .data-table,
  .cassets-workspace .ui-table-desktop .data-table,
  .inventory-workspace .ui-table-desktop .data-table,
  .perf-workspace .ui-table-desktop .data-table {
    min-width: 0;
  }

  .form-panel,
  .ui-form {
    max-width: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .template-actions .btn,
  .template-actions form {
    flex: 1 1 calc(50% - 0.25rem);
  }
}

@media (max-width: 560px) {
  .ui-summary {
    grid-template-columns: 1fr;
  }

  .ui-card-actions .btn,
  .ui-card-actions form {
    flex: 1 1 100%;
  }
}

/* Asset list mobile cards (client / manager / inventory / perf) */
.cassets-cards-mobile,
.inventory-cards-mobile,
.perf-cards-mobile {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0.65rem;
  gap: 0.55rem;
}

.cassets-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: #f3f8f6;
}

.cassets-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.cassets-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  .cassets-table-desktop {
    display: none !important;
  }

  .cassets-cards-mobile {
    display: grid !important;
  }

  .cassets-workspace .cassets-table {
    min-width: 0;
  }

  .inventory-table-desktop {
    display: none !important;
  }

  .inventory-cards-mobile {
    display: grid !important;
  }

  .inventory-side {
    order: -1;
  }

  .perf-table-desktop {
    display: none !important;
  }

  .perf-cards-mobile {
    display: grid !important;
  }
}

