/* Allow text selection only on form elements and editable content */
input, textarea, [contenteditable="true"] {
  user-select: text;
}

/* UI Components - Reusable interface elements */

/* ========================================
   LINE ITEMS TABLE (Excel-style)
   ======================================== */

.line-items-container {
    background-color: transparent;
    border-radius: var(--radius-lg);
    height: fit-content;
}

 

.line-items-table {
    margin-bottom: 0;
    background-color: transparent;
}

.line-items-table thead th {
    background-color: transparent;
    border: 1px solid var(--neutral-300);
    font-weight: 600;
    color: var(--neutral-700);
    text-align: center;
    vertical-align: middle;
    padding: 3px 3px;
    font-size: 0.875rem;
}

.line-items-table tbody td {
    border: 1px solid var(--neutral-300);
    padding: 2px 3px;
    vertical-align: middle;
}

.line-items-table input.form-control {
    background-color: transparent;
    border: none;
    padding: 2px 3px;
    font-size: 0.875rem;
    height: auto;
    min-height: 20px;
}

.line-items-table input.form-control:focus {
    background-color: var(--surface-warning-subtle);
    box-shadow: inset 0 0 0 1px var(--status-warning);
    outline: none;
}

.line-items-table input[readonly] {
    background-color: transparent !important;
    /*color: var(--neutral-600);*/
    color: var(--status-urgent);
}

.line-items-table .btn-xs {
    padding: 2px 6px;
    font-size: 0.75rem;
    line-height: 1.2;
}

.line-items-table tbody tr:hover {
    background-color: transparent;
}

.totals-summary {
    padding: 0.75rem 0;
}

.total-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 90px;
}

.total-label {
    font-size: 0.875rem;
    color: var(--neutral-600);
    font-weight: normal;
}

.total-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--neutral-700);
}

.total-field.final-total {
    border-left: 1px solid var(--neutral-300);
    padding-left: 0.75rem;
    margin-left: 0.25rem;
}

.total-field.final-total .total-label {
    color: var(--neutral-700);
    font-weight: 500;
}

.total-field.final-total .total-value {
    font-size: 0.9rem;
    color: var(--neutral-700);
    font-weight: 600;
}

.total-value.discount {
    color: var(--status-error);
}

/* Generic Edit with Lines Layout */
.modal-body .row {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.modal-body .col-md-5,
.modal-body .col-md-7 {
    padding: 0 15px;
    display: flex;
    flex-direction: column;
}

.modal-body .col-md-5 {
    padding-right: 20px;
    margin-right: 0;
}

.modal-body .col-md-7 {
    padding-left: 20px;
}

/* Ensure columns stay side by side */
@media (min-width: 768px) {
    .modal-body .row {
        display: flex;
        flex-direction: row;
    }
    
    .modal-body .col-md-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }
    
    .modal-body .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  gap: var(--spacing-xs);
  background: none;
  color: var(--primary-color);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Solid buttons — one shared box shape, one background/hover pair per colour.
   Phase 2 kept the box shape as the literal .btn-add/.btn-success/.btn-primary
   already rendered (D-4's "preserve the rendered value"), which is why this rule
   held `0.25rem 0.35rem` and `0.75rem` as bare numbers while everything around it
   used tokens.
   Phase 5 is the phase that spends that: the box is tokens now and it is bigger.
   0.25rem/0.35rem was a 28px-tall target with 5.6px of side padding — under the
   44px touch target D-2's phone floor implies, and visibly cramped next to a 14px
   label. It is --spacing-xs/--spacing-sm (4/8px) on a 2.25rem (36px) floor. Icon-
   only buttons stay square because min-width equals min-height. */
/* X-46: `.btn-add` was missing from this list while sitting in every other solid-button
   list in the file, so it took the fill but not the label colour and fell through to the
   base .btn colour — --primary-color. Invisible while the fill was #10b981 (5.7:1 against
   #2C2C2C), a 2.55:1 failure the moment PD-26 darkened the fill. Found by the colour
   session's own button audit. */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-add,
.btn-danger,
.btn-warning,
.btn-info {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--text-inverse);
  border-width: 1px;
  border-style: solid;
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--btn-secondary-bg);
  border-color: var(--btn-secondary-bg);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--btn-secondary-hover);
  border-color: var(--btn-secondary-hover);
}

.btn-success,
.btn-add {
  background-color: var(--btn-add-bg);
  border-color: var(--btn-add-bg);
}

.btn-success:hover:not(:disabled),
.btn-add:hover:not(:disabled) {
  background-color: var(--btn-add-hover);
  border-color: var(--btn-add-hover);
}

/* B-11: `.btn-remove` was an alias on these three selector lists and on one rule
   in materials-buildup.css, applied by nothing. Removed in phase 3. The
   --btn-remove-* tokens stay — B-11 read them as dead too, but .btn-danger and
   .btn-outline-danger below consume them. */
.btn-danger {
  background-color: var(--btn-remove-bg);
  border-color: var(--btn-remove-bg);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--btn-remove-hover);
  border-color: var(--btn-remove-hover);
}

.btn-warning {
  background-color: var(--btn-warning-bg);
  border-color: var(--btn-warning-bg);
}

.btn-warning:hover:not(:disabled) {
  background-color: var(--btn-warning-hover);
  border-color: var(--btn-warning-hover);
}

.btn-info {
  background-color: var(--btn-info-bg);
  border-color: var(--btn-info-bg);
}

.btn-info:hover:not(:disabled) {
  background-color: var(--btn-info-hover);
  border-color: var(--btn-info-hover);
}

/* All solid buttons: hover lifts and keeps white text */
.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-add:hover:not(:disabled),
.btn-danger:hover:not(:disabled),
.btn-warning:hover:not(:disabled),
.btn-info:hover:not(:disabled) {
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Outline buttons — transparent fill, coloured border/text, light tint on hover.
   New family (B-03): none of these rendered a colour before. Padding/border/
   radius are tokens per D-1; the box shape matches the plain .btn base rather
   than the compact solid-button box, since every current outline call site
   carries a text label, not an icon. */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
  background: none;
  border-width: 1px;
  border-style: solid;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.btn-outline-secondary {
  color: var(--btn-secondary-bg);
  border-color: var(--btn-secondary-bg);
}

.btn-outline-secondary:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--btn-secondary-bg) 10%, transparent);
}

.btn-outline-success {
  color: var(--btn-add-bg);
  border-color: var(--btn-add-bg);
}

.btn-outline-success:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--btn-add-bg) 10%, transparent);
}

.btn-outline-danger {
  color: var(--btn-remove-bg);
  border-color: var(--btn-remove-bg);
}

.btn-outline-danger:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--btn-remove-bg) 10%, transparent);
}

.btn-outline-warning {
  color: var(--btn-warning-bg);
  border-color: var(--btn-warning-bg);
}

.btn-outline-warning:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--btn-warning-bg) 10%, transparent);
}

.btn-outline-info {
  color: var(--btn-info-bg);
  border-color: var(--btn-info-bg);
}

.btn-outline-info:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--btn-info-bg) 10%, transparent);
}

/* Ghost is the unmodified .btn base above — no class needed. */

.btn-link {
  background: none;
  border: none;
  padding: 0;
  min-width: 0;
  min-height: 0;
  color: var(--primary-color);
  text-decoration: none;
}

.btn-link:hover:not(:disabled) {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Icon-only modal close (×) — same shape as .btn-link, muted rather than primary
   since it is a dismiss action, not a call to action. */
.btn-close-modal {
  background: none;
  border: none;
  padding: var(--spacing-xs);
  min-width: 0;
  min-height: 0;
  color: var(--text-muted);
}

.btn-close-modal:hover:not(:disabled) {
  color: var(--text-primary);
}

.btn-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.btn-sm {
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
}

.btn-full-width {
  width: 100%;
}

/* ========================================
   FORM STYLING
   ======================================== */

.form {
  width: 100%;
}

.form-row {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px; /* Ensure reasonable minimum width before wrapping */
  margin-bottom: var(--spacing-sm); /* Reduced spacing */
}

.form-group {
  flex: 1;
  margin-bottom: var(--spacing-sm); /* Reduced spacing for better space usage */
}

.form-label {
  display: block;
  margin-bottom: 0.15rem; /* Much tighter spacing - was var(--spacing-xs) = 0.25rem */
  font-weight: 400; /* Lighter weight for elegance */
  color: var(--text-secondary); /* More discrete gray */
  font-size: 0.75rem; /* Smaller, more elegant */
  letter-spacing: 0.3px; /* Subtle spacing for clarity */
  line-height: 1.2; /* Tighter line height */
}

.form-input,
.form-select,
.form-control {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base); /* Now uses the reduced base font size */
  background-color: var(--bg-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--surface-info-tint);
}

textarea.form-input,
textarea.form-control {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  font-family: var(--font-family);
}

.was-validated .form-input:invalid,
.was-validated .form-control:invalid {
  border-color: var(--status-error);
}

/* Color input specific styling */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.color-input {
  width: 50px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  background: none;
  transition: border-color 0.2s ease;
}

.color-input:hover {
  border-color: var(--primary-color);
}

.color-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--surface-info-tint);
}

.color-input::-webkit-color-swatch-wrapper {
  padding: var(--spacing-xs);
}

.color-input::-webkit-color-swatch {
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
}

.color-input::-moz-color-swatch {
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
}

.color-value {
  font-family: monospace;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  min-width: 70px;
  text-align: center;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.form-check-input {
  width: auto !important;
  margin: 0;
}

.form-check-label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.required {
  color: var(--status-error);
  font-weight: bold;
}

/* Form validation states */
.form-group.has-error .form-input,
.form-group.has-error .form-control {
  border-color: var(--status-error);
  box-shadow: 0 0 0 3px var(--surface-error-tint);
}

.form-group.has-success .form-input,
.form-group.has-success .form-control {
  border-color: var(--status-success);
  box-shadow: 0 0 0 3px var(--surface-success-tint);
}

.form-help,
.form-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
  display: block;
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--status-error);
  margin-top: var(--spacing-xs);
}

/* ========================================
   TABLES
   ======================================== */

.table-type-show{
  border: 0;
  text-align: left;
  width: 100%;
  table-layout: auto;
  
  border-collapse: collapse;  /* Remove gaps between cells */
  border-spacing: 0; 
}

.table-type-show th{
  background-color:  var(--header-bg);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.table-type-show td{
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

/* Phase 5: the last row does not need a rule under it — the card shell PD-08 puts
   around this table (views/components/generic_show_adv.php) already closes it. */
.table-type-show tbody tr:last-child th,
.table-type-show tbody tr:last-child td {
  border-bottom: 0;
}

/* I-04 (phase 4) — relocated verbatim from a <style> block that
   views/components/generic_show_adv.php echoed once per render. The two-column
   show table stacks into label/value blocks on a phone, which already satisfies
   D-2 (nothing is hidden), so the declarations are unchanged.
   The `var(--neutral-300)` below is deliberately NOT converted: --border-color is var(--theme-gray-200) on
   the minuciosa theme, so tokenising it here would move a pixel for no named
   finding. It joins the colour backlog — Q-07 / I-03. */
@media (max-width: 768px) {
  .table-type-show.responsive-2col {
    display: block;
  }

  .table-type-show.responsive-2col tbody tr {
    display: block;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--neutral-300);
    padding-bottom: 1rem;
  }

  .table-type-show.responsive-2col th,
  .table-type-show.responsive-2col td {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  /* I-08 (phase 5): this was `font-size: 0.78em`, commented "15% more compact:
     0.92 * 0.85 = 0.78". The data grid is the surface this app *is*, and it was
     rendering at 78% of an already-small base — 9.4px before this phase, measured
     in the browser. A token scale that the main surface opts out of is not a scale.
     --font-size-sm (13px) instead: still a step below body copy, still denser than
     the chrome around it, but legible. The th/td padding below stays in `em` on
     purpose so the cell box grows with the text rather than fighting it. */
  font-size: var(--font-size-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  table-layout: auto; /* Change from any fixed layout to auto for zoom compatibility */
  padding: auto;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.table-fixed-layout {
  table-layout: fixed !important;
  min-width: 100%;
}

.table th {
  background-color: var(--header-bg);
  padding: 0.55em 1em; /* increased padding from 0.35em 0.7em */
  text-align: left;
  font-weight: 600;
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table td {
  padding: 0.5em 1em; /* increased padding from 0.32em 0.7em */
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  /* Prevent cells from becoming focusable and showing text cursor */
  outline: none;
  cursor: default;
}


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

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

/* ----------------------------------------
   I-04 (phase 4) — the mobile table strategy.

   Was: a <style> block echoed once per render from
   views/components/index_table.php that set `display: none` on every column
   except .primary-column and .actions-column below 768px. D-2 (the responsive
   floor is a phone in portrait) makes deleting the data an unacceptable end
   state, so the columns stay and the table scrolls sideways instead.

   .table-wrapper already scrolls on the x axis at every width; below the phone
   breakpoint the primary column is pinned to the left edge so a row is still
   identifiable once the rest has scrolled past. The pinned cells need their own
   background — a transparent sticky cell shows the scrolling cells underneath.

   Known trade-off, recorded rather than hidden: because the pinned cells paint
   their own background, `.table tbody tr:hover` does not tint them. That is a
   hover state on a touch viewport, so it is not worth a specificity fight here;
   phase 5 owns the row-state palette (I-06).
   ---------------------------------------- */
@media (max-width: 768px) {
  /* Without a floor the table simply obeys `width: 100%` and crushes every
     column into the 358px the wrapper has — measured: all 7 columns rendered,
     but 63px each and the last one clipped to "Con…" by the .table td ellipsis.
     Present-but-unreadable is not "reachable", so the table gets a minimum
     width and the wrapper scrolls to it.
     A per-column `min-width` was tried first and does not work here: list
     tables carry .table-fixed-layout (`table-layout: fixed`), which takes its
     column widths from the header row alone and ignores min-width on the body
     cells, and index_table.php writes `style="width:…;min-width:…"` inline on
     the <th> for every configured column — an inline declaration a class
     cannot outrank without !important. A floor on the table itself is the one
     lever that works without fighting either.
     Phase 5: the 40rem was a bare literal tagged "collapse in phase 5". There is
     still no width scale for it to join — one floor is not a scale — so it became
     its own named token (--table-min-width) in variables.css rather than being
     folded into an unrelated ramp. The value is unchanged: the type scale grew by
     2px and 40rem was already measured with headroom, re-checked at 390px below. */
  .table-wrapper > .table {
    min-width: var(--table-min-width);
  }

  .table th.primary-column,
  .table td.primary-column {
    position: sticky;
    left: 0;
    z-index: 1;
  }

  .table th.primary-column {
    background-color: var(--header-bg);
  }

  .table td.primary-column {
    background-color: var(--bg-primary);
  }
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.card-content {
  padding: var(--spacing-lg);
}





/* ========================================
   BADGES & STATUS
   ======================================== */

/* I-06 (phase 5) — the decision, and what it does and does not change.
   Badge fills are user data: workflow_statuses.color, configured per status in
   system config, currently everything from #f0eacc to pure #ff0000. The database is
   read-only for this programme and, more to the point, constraining a customer's own
   status colours to a token-derived set is a product decision, not a CSS one. So the
   colours are accepted as deliberately loud.
   What phase 5 does own is the *shape* they are poured into, and the contrast rule
   that renders them. The pill below is token-driven; the contrast rule moved from a
   perceived-brightness average to a real WCAG ratio in dynamic-badge-colors.js (X-22),
   which is what actually made the mid-tone statuses legible. */
.badge {
  display: inline-flex;
  align-items: center;
  font-weight: var(--badge-font-weight);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-pill);
  line-height: 1.2;
  white-space: nowrap;
}

/* Badge sizes - Minimal */
.badge-sm {
  font-size: var(--badge-font-size-sm);
}

.badge-md {
  font-size: var(--badge-font-size-md);
}

.badge-lg {
  font-size: var(--badge-font-size-lg);
}



/* Static badge styles with predefined colors - text color is dynamically calculated via data-bg-color attribute */

.badge-primary {
  background-color: var(--surface-info-tint);
  color: var(--primary-color);
}

.badge-success {
  background-color: var(--surface-success-tint);
  color: var(--status-success);
}

.badge-warning {
  background-color: var(--surface-warning-tint);
  color: var(--status-warning);
}

.badge-error {
  background-color: var(--surface-error-solid);
  color: white;
}

.badge-info {
  background-color: var(--surface-info-tint);
  color: var(--status-info);
}

.badge-on-hold {
  background-color: var(--surface-neutral-tint);
  color: var(--status-on-hold);
}

.badge-secondary {
  background-color: var(--surface-neutral-tint);
  color: var(--secondary-color);
}

.badge-approaching {
  background-color: var(--status-approaching-bg);
  color: var(--status-approaching);
}

.badge-soon-yellow {
  background-color: var(--status-soon-bg);
  color: var(--status-soon);
}

.badge-urgent-orange {
  background-color: var(--status-urgent-bg);
  color: var(--status-urgent-text);
}

/* Dynamic badge style - use data-bg-color attribute to set background, text color is calculated automatically */
.badge[data-bg-color] {
  /* Background and text color will be set by JavaScript in dynamic-badge-colors.js */
  /* This allows badges to have any custom color while maintaining contrast */
}

/* ========================================
   ACTIONS & LINKS
   ======================================== */

.actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  justify-content: flex-end;
}

.actions-column {
  width: 140px;
  text-align: right;
  white-space: nowrap;
}

.actions-column .actions {
  justify-content: flex-end;
}

.clickable-row:hover {
  background-color: var(--table-row-hover-bg);
}

.clickable-row:hover td {
  background-color: transparent;
}

/* Ensure clickable rows have pointer cursor */
.clickable-row td {
  cursor: pointer !important;
}





/* ========================================
   SPECIAL COMPONENTS
   ======================================== */

/* Login Page Components */
.login-body {
  background: var(--color-gray-50);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

.login-container {
  max-width: 400px;
  width: 100%;
  padding: var(--spacing-lg);
}

.login-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.login-header h1 {
  color: var(--primary-color);
  margin-bottom: var(--spacing-xs);
}

.login-header p {
  color: var(--color-gray-600);
  margin: 0;
}

.demo-users {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-gray-100);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.demo-users h3 {
  margin-top: 0;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.demo-users p {
  margin: var(--spacing-xs) 0;
  font-size: var(--font-size-sm);
}

/* ========================================
   EMPTY STATE STYLING
   ======================================== */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-3xl) var(--spacing-md);
  min-height: 300px;
  text-align: center;
}

.empty-state-content {
  max-width: 400px;
  color: var(--text-secondary);
}

.empty-state-icon {
  color: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.empty-state-message {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.5;
}

/* Responsive empty state */
@media (max-width: 768px) {
  .empty-state {
    padding: var(--spacing-lg) var(--spacing-md);
    min-height: 200px;
  }
  
  .empty-state-title {
    font-size: var(--font-size-base);
  }
  
  .empty-state-message {
    font-size: var(--font-size-sm);
  }
}

/* Dashboard Status Cards */
.status-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.status-card-link {
    text-decoration: none;
    color: inherit;
}

.status-card {
    border: 1px solid var(--theme-gray-300);
    border-radius: var(--radius-lg);
    background: var(--theme-gray-50);
    padding: var(--spacing-lg);
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-card:hover {
    background: var(--theme-gray-100);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--theme-shadow-medium);
}

.status-count {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 8px;
}

.status-name {
    font-weight: 500;
    color: var(--theme-gray-900);
    font-size: 1.1em;
}

/* ========================================
   NOTIFICATION SYSTEM
   ======================================== */

.notification-bell {
    position: relative;
}

.notification-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--font-size-lg);
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.notification-button:hover {
    color: var(--primary-color);
    background-color: var(--bg-hover);
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
    z-index: 2400; /* Below modals (2500) and alerts (3000), above floating actions */
    display: none;
    margin-top: var(--spacing-sm);
}

.notification-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: var(--spacing-md);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    font-size: var(--font-size-sm);
}

.dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-loading,
.notification-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.notification-empty i {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    display: block;
    opacity: 0.5;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--status-error);
    color: white;
    border-radius: var(--radius-circle);
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
    animation: pulse 2s infinite;
}

.notification-badge.zero {
    display: none !important;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.notification-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
}

.notification-item:hover {
    background-color: var(--bg-hover);
}

.notification-item.unread {
    background-color: var(--surface-info-tint-soft);
    border-left: 4px solid var(--primary-color);
    font-weight: 600;
}

.notification-item.unread .notification-title {
    font-weight: 700;
    color: var(--primary-color);
}

.notification-item.unread .notification-icon {
    color: var(--primary-color);
}

/* Read notifications have muted styling */
.notification-item:not(.unread) {
    opacity: 0.8;
}

.notification-item:not(.unread) .notification-title {
    font-weight: 500;
    color: var(--text-secondary);
}

.notification-item:not(.unread) .notification-icon {
    color: var(--text-muted);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
    width: 100%;
}

.notification-icon {
    margin-right: var(--spacing-sm);
    color: var(--primary-color);
    width: 20px;
    text-align: center;
    margin-top: 2px;
}

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

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-xs) 0;
    font-size: var(--font-size-sm);
}

.notification-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.notification-message {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.4;
    margin: 0;
}

.notification-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    margin-left: var(--spacing-sm);
    align-items: flex-start;
}

.notification-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    transition: color 0.2s ease;
}

.notification-action:hover {
    color: var(--primary-color);
}

.notification-actions .btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
}

.notifications-empty {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.notifications-empty i {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.notifications-header h1 {
    margin: 0;
    color: var(--text-primary);
}

.mark-all-read-btn {
    font-size: var(--font-size-sm);
}

.status-selector {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.status-selector select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    background-color: var(--bg-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-block-end: 1rem;
}

.status-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--surface-info-tint);
}

 

.status-selector h4 {
    margin-block-end: 1rem;
    color: var(--text-primary); 
    font-size: var(--font-size-lg);
}