/* Reusable app styles – login & user area */

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-focus: rgba(79, 70, 229, 0.2);
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-success: #059669;
  --color-success-bg: #ecfdf5;
  --font-sans: "Plus Jakarta Sans", "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --input-height: 2.75rem;
  --transition: 0.2s ease;
  /* App shell (sidebar dark theme) */
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #e0e7ff;
  --sidebar-text-muted: #a5b4fc;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(79, 70, 229, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* Layout */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.page:has(.app-shell) {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.page--login {
  background: linear-gradient(160deg, #eef2ff 0%, #e0e7ff 40%, #f0f4ff 100%);
}

.page__inner {
  width: 100%;
  max-width: 420px;
}

/* Card */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
}

.card__title {
  margin: 0 0 var(--space-sm);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--color-text);
}

.card__subtitle {
  margin: 0 0 var(--space-lg);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Form card: full width of container */
.card--form {
  width: 100%;
  max-width: 100%;
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.form__input {
  width: 100%;
  height: var(--input-height);
  padding: 0 var(--space-md);
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea.form__input {
  height: auto;
  min-height: 5rem;
  padding: var(--space-sm) var(--space-md);
  resize: vertical;
}

.form__input::placeholder {
  color: var(--color-text-muted);
}

.form__input:hover {
  border-color: #cbd5e1;
}

.form__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.form__input:invalid:not(:placeholder-shown) {
  border-color: #c9cdd2;
}

.form__static.form__input {
  background: #f1f5f9;
  cursor: default;
}

.form__hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.form__actions {
  margin-top: var(--space-xs);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

/* Two-column form layout */
.form--two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.form--two-cols .form__group--full,
.form--two-cols .form__actions {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .form--two-cols {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--input-height);
  padding: 0 var(--space-lg);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

.btn:hover {
  background: var(--color-primary-hover);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 2rem;
  padding: 0 var(--space-md);
  font-size: 0.8125rem;
}

.btn--secondary {
  background: #64748b;
  color: #fff;
}

.btn--secondary:hover {
  background: #475569;
}

.btn--danger {
  background: #dc2626;
  color: #fff;
}

.btn--danger:hover {
  background: #b91c1c;
}

/* Alert / message */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  margin-bottom: var(--space-lg);
}

.alert--error {
  color: var(--color-error);
  background: var(--color-error-bg);
  border: 1px solid #fecaca;
}

.alert--success {
  color: var(--color-success);
  background: var(--color-success-bg);
  border: 1px solid #a7f3d0;
}

/* User area layout (for reuse in user/*) */
.page--user {
  align-items: flex-start;
  padding: var(--space-xl);
}

.page--user .page__inner {
  max-width: 720px;
}

/* App shell: sidebar + topbar + content */
:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}

.app-shell--sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
}

.sidebar__brand {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar__brand-link {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--sidebar-text);
  text-decoration: none;
  line-height: 1.3;
  transition: color var(--transition);
}

.sidebar__brand-link:hover {
  color: #fff;
}

.sidebar__nav {
  padding: var(--space-md) 0;
  list-style: none;
  margin: 0;
}

.sidebar__nav-item {
  margin: 0;
}

.sidebar__nav-section {
  margin-top: var(--space-lg);
  padding: var(--space-sm) var(--space-lg) var(--space-xs);
  border-top: 1px solid rgba(148, 163, 184, 0.4);
}

.sidebar__nav-section-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.9);
}

.sidebar__nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--sidebar-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  transition: background var(--transition), color var(--transition);
}

.sidebar__nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.sidebar__nav-link--active {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  gap: var(--space-md);
  flex: 0 0 auto;
  box-shadow: var(--shadow);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.btn--icon {
  min-height: 40px;
  width: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid transparent;
}

.btn--icon:hover {
  background: #f1f5f9;
  color: var(--color-primary);
}

.btn--icon svg {
  display: block;
  margin: auto;
}

.topbar__profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar__welcome {
  font-size: 0.875rem;
  color: var(--color-text);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.app-content {
  flex: 1;
  padding: var(--space-xl);
  background: var(--color-bg);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.page-header__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--color-text);
}

.page-header__meta {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* Table with search + filters (DataTable-style) */
.table-search-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.table-search-wrap .table-search-input {
  width: 100%;
  max-width: 320px;
  height: var(--input-height);
  padding: 0 var(--space-md);
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.table-search-wrap .table-search-input::placeholder {
  color: var(--color-text-muted);
}

.table-search-wrap .table-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.table-search-wrap .table-filter-select {
  height: var(--input-height);
  min-width: 160px;
  padding: 0 var(--space-md);
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.table-search-wrap .table-filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.table-wrap {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap th,
.table-wrap td {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.table-wrap th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: #f8fafc;
}

.table-wrap th.th--sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.5em;
  white-space: nowrap;
}

.table-wrap th.th--sortable:hover {
  color: var(--color-primary);
}

.table-wrap th.th--sortable::after {
  content: '';
  position: absolute;
  right: 0.5em;
  opacity: 0.35;
  font-size: 0.65em;
}

.table-wrap th.th--sort-asc::after {
  content: '\25B2';
  opacity: 1;
  color: var(--color-primary);
}

.table-wrap th.th--sort-desc::after {
  content: '\25BC';
  opacity: 1;
  color: var(--color-primary);
}

.table-wrap thead th {
  position: relative;
}

.table-wrap tr:last-child td {
  border-bottom: none;
}

.table-wrap tr.table-row--hidden {
  display: none;
}

/* Status badges (button-type backgrounds) */
.status-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  border-radius: 999px;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
}

.status-badge--assigned {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge--pending {
  background: #fef3c7;
  color: #b45309;
}

.status-badge--completed {
  background: #d1fae5;
  color: #065f46;
}

.status-badge--failed {
  background: #fee2e2;
  color: #b91c1c;
}

/* User type badges */
.status-badge--owner {
  background: #ede9fe;
  color: #5b21b6;
}

.status-badge--admin {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge--company {
  background: #ccfbf1;
  color: #0f766e;
}

.status-badge--technician {
  background: #e2e8f0;
  color: #475569;
}

/* Installation status (devices): Available=green, Installed=blue, Discarded=red */
.status-badge--available {
  background: #d1fae5;
  color: #065f46;
}

.status-badge--installed {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge--discarded {
  background: #fee2e2;
  color: #b91c1c;
}

/* Photo thumbnails in table */
.photos-cell {
  white-space: nowrap;
}

.photo-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0 2px 0 0;
  background: #f1f5f9;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.photo-thumb:hover {
  background: #e2e8f0;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.photo-thumb:last-child {
  margin-right: 0;
}

.photo-thumb svg {
  display: block;
}

/* Small thumbnails in detail modal (click to open lightbox) */
.detail-photos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.photo-thumb--small {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  overflow: hidden;
}

.photo-thumb--small .photo-thumb__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb--small svg {
  display: none;
}

/* Photo modal (lightbox) */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.photo-modal[hidden] {
  display: none;
}

.photo-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.photo-modal__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-modal__img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.photo-modal__close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.9;
}

.photo-modal__close:hover {
  opacity: 1;
}

/* Table action icons */
.th-actions {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

.actions-cell {
  white-space: nowrap;
  text-align: center;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-icon--view {
  color: #0369a1;
}

.btn-icon--view:hover {
  background: #e0f2fe;
  color: #0369a1;
}

.btn-icon--edit {
  color: #0d9488;
}

.btn-icon--edit:hover {
  background: #ccfbf1;
  color: #0d9488;
}

.btn-icon--delete {
  color: #b91c1c;
}

.btn-icon--delete:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-icon svg {
  display: block;
}

/* Reusable detail modal (view row details) */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.detail-modal__content {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.detail-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.detail-modal__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.detail-modal__close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.detail-modal__close:hover {
  color: var(--color-text);
  background: #f1f5f9;
}

.detail-modal__body {
  padding: var(--space-xl);
}

.detail-dl {
  margin: 0;
}

.detail-dl dt {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-top: var(--space-md);
}

.detail-dl dt:first-child {
  margin-top: 0;
}

.detail-dl dd {
  margin: var(--space-xs) 0 0;
  font-size: 0.9375rem;
}

/* Reusable delete confirmation modal */
.delete-modal {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.delete-modal[hidden] {
  display: none;
}

.delete-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.delete-modal__content {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 100%;
  padding: var(--space-xl);
}

.delete-modal__title {
  margin: 0 0 var(--space-md);
  font-size: 1.125rem;
  font-weight: 600;
}

.delete-modal__text {
  margin: 0 0 var(--space-lg);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.delete-modal__actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

.table-wrap--profile th {
  text-transform: none;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

/* Dashboard */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.dashboard-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  transition: transform var(--transition), box-shadow var(--transition);
}

.dashboard-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.dashboard-stat__value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.dashboard-stat__label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.dashboard-stat--jobs .dashboard-stat__value { color: var(--color-primary); }
.dashboard-stat--devices .dashboard-stat__value { color: #0d9488; }
.dashboard-stat--vehicles .dashboard-stat__value { color: #7c3aed; }
.dashboard-stat--companies .dashboard-stat__value { color: #ea580c; }
.dashboard-stat--users .dashboard-stat__value { color: #2563eb; }

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
}

.dashboard-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  padding: var(--space-xl);
}

.dashboard-card__title {
  margin: 0 0 var(--space-lg);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.dashboard-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.dashboard-card__header .dashboard-card__title {
  margin: 0;
}

.dashboard-chart-row {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.dashboard-donut {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.dashboard-donut__ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    #10b981 0 calc(var(--p-completed, 0) * 1%),
    #4f46e5 calc(var(--p-completed, 0) * 1%) calc((var(--p-completed, 0) + var(--p-assigned, 0)) * 1%),
    #f59e0b calc((var(--p-completed, 0) + var(--p-assigned, 0)) * 1%) calc((var(--p-completed, 0) + var(--p-assigned, 0) + var(--p-pending, 0)) * 1%),
    #ef4444 calc((var(--p-completed, 0) + var(--p-assigned, 0) + var(--p-pending, 0)) * 1%) calc((var(--p-completed, 0) + var(--p-assigned, 0) + var(--p-pending, 0) + var(--p-failed, 0)) * 1%),
    #94a3b8 calc((var(--p-completed, 0) + var(--p-assigned, 0) + var(--p-pending, 0) + var(--p-failed, 0)) * 1%) 100%
  );
  position: relative;
}

.dashboard-donut__ring::after {
  content: '';
  position: absolute;
  inset: 20%;
  background: var(--color-surface);
  border-radius: 50%;
}

.dashboard-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 140px;
}

.dashboard-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--color-text);
}

.dashboard-legend__item strong {
  margin-left: auto;
  font-weight: 600;
}

.dashboard-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dashboard-legend__item--completed .dashboard-legend__dot { background: #10b981; }
.dashboard-legend__item--assigned .dashboard-legend__dot { background: #4f46e5; }
.dashboard-legend__item--pending .dashboard-legend__dot { background: #f59e0b; }
.dashboard-legend__item--failed .dashboard-legend__dot { background: #ef4444; }
.dashboard-legend__item--other .dashboard-legend__dot { background: #94a3b8; }

.dashboard-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dashboard-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 2rem;
  align-items: center;
  gap: var(--space-md);
}

.dashboard-bar__label {
  font-size: 0.875rem;
  color: var(--color-text);
}

.dashboard-bar__track {
  height: 24px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dashboard-bar__fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.5s ease;
}

.dashboard-bar__fill--completed { background: #10b981; }
.dashboard-bar__fill--assigned { background: #4f46e5; }
.dashboard-bar__fill--pending { background: #f59e0b; }
.dashboard-bar__fill--failed { background: #ef4444; }

.dashboard-bar__value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: right;
}

.dashboard-empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.dashboard-empty a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.dashboard-empty a:hover {
  text-decoration: underline;
}

.dashboard-table-wrap {
  overflow-x: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dashboard-table th,
.dashboard-table td {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.dashboard-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-table tr:last-child td {
  border-bottom: none;
}

.dashboard-table tr:hover td {
  background: #f8fafc;
}

/* Login branding */
.login-brand {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-brand__logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text);
  line-height: 1.25;
}
