/* ==========================================================================
   DMCFS Care — Design System
   New visual layer loaded after css/style.css. Nothing in style.css is
   removed; chrome-level selectors (#sidebar, .navbar, .page-header,
   .btn.btn-primary) are overridden here so the shell cutover applies
   everywhere at once. All new component classes are prefixed `ds-`.
   ========================================================================== */

:root {
  --ds-primary: #1A73E8;
  --ds-primary-dark: #174EA6;
  --ds-sidebar-bg: #202124;
  --ds-sidebar-bg-active: #2D2E30;
  --ds-sidebar-text: #E8EAED;
  --ds-sidebar-text-muted: #9AA0A6;

  --ds-success: #34A853;
  --ds-warning: #FBBC04;
  --ds-danger: #EA4335;
  --ds-info: #4285F4;
  --ds-priority-high: #F29900;

  --ds-surface: #FFFFFF;
  --ds-bg: #F8F9FA;
  --ds-border: #E8EAED;
  --ds-text-primary: #202124;
  --ds-text-secondary: #5F6368;

  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 24px;
  --ds-space-6: 32px;
  --ds-space-7: 40px;
  --ds-space-8: 48px;

  --ds-elevation-1: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  --ds-elevation-2: 0 4px 12px 0 rgba(0, 0, 0, 0.18), 0 8px 24px 0 rgba(0, 0, 0, 0.14);

  --ds-radius: 10px;
}

body {
  background: var(--ds-bg);
  font-family: "Roboto", "Poppins", Arial, sans-serif;
  color: var(--ds-text-primary);
}

h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5,
.card_heading, .ds-kpi-card .ds-kpi-value {
  font-family: "Poppins", Arial, sans-serif;
}

a {
  color: var(--ds-primary);
}

/* ---- Buttons ------------------------------------------------------- */

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

.btn.btn-primary:hover,
.btn.btn-primary:focus {
  background: var(--ds-primary-dark) !important;
  border-color: var(--ds-primary-dark) !important;
}

/* ---- Top navigation -------------------------------------------------- */

.navbar {
  background: var(--ds-surface) !important;
  border-bottom: 1px solid var(--ds-border);
  box-shadow: var(--ds-elevation-1);
  position: sticky;
  top: 0;
  z-index: 1030;
}

#sidebarCollapse {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
}

.dropdown-item:hover {
  background-color: var(--ds-primary);
  color: #fff;
}

/* ---- Sidebar ----------------------------------------------------------- */

#sidebar {
  background: var(--ds-sidebar-bg);
  box-shadow: none;
  min-width: 260px;
  max-width: 260px;
}

#sidebar p,
#sidebar .ds-sidebar-user-name {
  color: var(--ds-sidebar-text);
}

#sidebar ul li a {
  color: var(--ds-sidebar-text);
  border-bottom: none;
  border-radius: 6px;
  padding: 8px 10px;
}

#sidebar ul li a:hover {
  background: var(--ds-sidebar-bg-active);
  color: #fff;
}

#sidebar .ds-sidebar-section-label {
  color: var(--ds-sidebar-text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .06em;
  font-weight: 600;
  padding: var(--ds-space-4) var(--ds-space-3) var(--ds-space-1);
}

#sidebar .sidebar_submenu {
  background: transparent;
  color: var(--ds-sidebar-text);
  border-radius: 6px;
}

#sidebar .sidebar_submenu:hover {
  background: var(--ds-sidebar-bg-active);
}

#sidebar .sidebar_subsubmenu {
  color: var(--ds-sidebar-text-muted);
}

#sidebar .sidebar_subsubmenu:hover {
  color: #fff;
}

/* ---- Page header / cards ------------------------------------------- */

.page-header {
  background-image: none;
  background-color: var(--ds-primary);
}

.page-header:before {
  content: none;
}

.card_heading {
  background-color: var(--ds-primary);
  border-radius: var(--ds-radius) var(--ds-radius) 0 0;
}

.card1 {
  border-radius: var(--ds-radius);
  overflow: hidden;
}

/* ---- Status badges (aliases onto existing badge classes) ----------- */

.ds-badge-open, .badge-danger {
  background-color: var(--ds-danger) !important;
}

.ds-badge-in-progress, .badge-warning {
  background-color: var(--ds-warning) !important;
  color: var(--ds-text-primary) !important;
}

.ds-badge-resolved {
  background-color: var(--ds-info) !important;
  color: #fff !important;
}

.ds-badge-closed, .badge-success {
  background-color: var(--ds-success) !important;
}

/* ---- Tile grid (Settings hub / Reports hub) ------------------------- */

.ds-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--ds-space-5);
}

.ds-tile {
  display: block;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: var(--ds-space-5);
  box-shadow: var(--ds-elevation-1);
  transition: transform .15s ease, box-shadow .15s ease;
  color: var(--ds-text-primary);
}

a.ds-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-elevation-2);
  color: var(--ds-text-primary);
}

.ds-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: var(--ds-primary);
  margin-bottom: var(--ds-space-3);
}

.ds-tile-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: var(--ds-space-1);
}

.ds-tile-desc {
  color: var(--ds-text-secondary);
  font-size: 13px;
}

.ds-tile-disabled {
  opacity: .55;
  pointer-events: none;
}

.ds-tile-badge {
  float: right;
  font-size: 11px;
  background: var(--ds-border);
  color: var(--ds-text-secondary);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ---- KPI / status cards --------------------------------------------- */

.ds-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--ds-space-4);
  margin-bottom: var(--ds-space-5);
}

.ds-kpi-card {
  display: block;
  background: var(--ds-surface);
  border-top: 4px solid var(--ds-primary);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-elevation-1);
  padding: var(--ds-space-4);
  color: var(--ds-text-primary);
}

a.ds-kpi-card:hover {
  color: var(--ds-text-primary);
  box-shadow: var(--ds-elevation-2);
}

.ds-kpi-card.ds-kpi-open { border-top-color: var(--ds-danger); }
.ds-kpi-card.ds-kpi-in-progress { border-top-color: var(--ds-warning); }
.ds-kpi-card.ds-kpi-resolved { border-top-color: var(--ds-info); }
.ds-kpi-card.ds-kpi-closed { border-top-color: var(--ds-success); }
.ds-kpi-card.ds-kpi-overdue { border-top-color: var(--ds-priority-high); }

.ds-kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.ds-kpi-label {
  color: var(--ds-text-secondary);
  font-size: 13px;
}

/* ---- Kanban board (My Dashboard) ------------------------------------ */

.ds-kanban-board {
  display: flex;
  gap: var(--ds-space-4);
  overflow-x: auto;
  padding-bottom: var(--ds-space-2);
  margin-bottom: var(--ds-space-5);
}

.ds-kanban-column {
  background: var(--ds-surface);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-elevation-1);
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  max-height: 600px;
}

.ds-kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ds-space-3) var(--ds-space-4);
  border-top: 4px solid var(--ds-primary);
  border-radius: var(--ds-radius) var(--ds-radius) 0 0;
  font-weight: 600;
}

.ds-kanban-column.ds-kanban-open .ds-kanban-column-header { border-top-color: var(--ds-danger); }
.ds-kanban-column.ds-kanban-in-progress .ds-kanban-column-header { border-top-color: var(--ds-warning); }
.ds-kanban-column.ds-kanban-resolved .ds-kanban-column-header { border-top-color: var(--ds-info); }
.ds-kanban-column.ds-kanban-closed .ds-kanban-column-header { border-top-color: var(--ds-success); }

.ds-kanban-column-count {
  background: var(--ds-bg);
  color: var(--ds-text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.ds-kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--ds-space-3);
  min-height: 80px;
  transition: background-color .15s ease, opacity .15s ease;
}

.ds-kanban-column-empty-hint {
  color: var(--ds-text-secondary);
  font-size: 12px;
  text-align: center;
  padding: var(--ds-space-4) var(--ds-space-2);
}

.ds-kanban-column-body.ds-kanban-drag-invalid {
  opacity: .35;
  pointer-events: none;
}

.ds-kanban-column-body.ds-kanban-drag-valid {
  background: #F0F7FF;
  outline: 2px dashed var(--ds-primary);
  outline-offset: -4px;
}

.ds-kanban-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-left: 3px solid var(--ds-border);
  border-radius: 6px;
  padding: var(--ds-space-3);
  margin-bottom: var(--ds-space-2);
  cursor: grab;
  font-size: 13px;
  color: var(--ds-text-primary);
}

.ds-kanban-card:active {
  cursor: grabbing;
}

.ds-kanban-card.ds-kanban-priority-1 { border-left-color: var(--ds-danger); }
.ds-kanban-card.ds-kanban-priority-2 { border-left-color: var(--ds-priority-high); }
.ds-kanban-card.ds-kanban-priority-3 { border-left-color: var(--ds-warning); }
.ds-kanban-card.ds-kanban-priority-4 { border-left-color: var(--ds-border); }

.ds-kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ds-kanban-card-id {
  font-weight: 600;
}

.ds-kanban-card-id a {
  color: var(--ds-text-primary);
}

.ds-kanban-card-desc {
  color: var(--ds-text-secondary);
  margin: 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ds-kanban-card-date {
  color: var(--ds-text-secondary);
  font-size: 11px;
}

.ds-kanban-ghost {
  opacity: .4;
}

.ds-kanban-chosen {
  box-shadow: var(--ds-elevation-2);
}

@media (max-width: 575.98px) {
  .ds-kanban-column {
    flex-basis: 240px;
  }
}

/* ---- Date range filter ------------------------------------------------ */

.ds-daterange {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: var(--ds-space-3) var(--ds-space-4);
  margin-bottom: var(--ds-space-5);
}

.ds-daterange input[type="date"] {
  border: 1px solid var(--ds-border);
  border-radius: 6px;
  padding: 6px 10px;
}

.ds-daterange .ds-daterange-quick {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ds-daterange .ds-daterange-quick button {
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--ds-text-secondary);
}

.ds-daterange .ds-daterange-quick button.active,
.ds-daterange .ds-daterange-quick button:hover {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: #fff;
}

/* ---- Notification bell + drawer -------------------------------------- */

.ds-notif-bell {
  position: relative;
  font-size: 20px;
  color: var(--ds-text-secondary);
  cursor: pointer;
  margin-right: var(--ds-space-4);
}

.ds-notif-bell:hover {
  color: var(--ds-primary);
}

.ds-notif-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--ds-danger);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  display: none;
}

.ds-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .3);
  z-index: 1040;
}

.ds-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  max-width: 92vw;
  height: 100%;
  background: var(--ds-surface);
  box-shadow: var(--ds-elevation-2);
  z-index: 1050;
  transition: right .2s ease;
  display: flex;
  flex-direction: column;
}

.ds-drawer.ds-drawer-open {
  right: 0;
}

.ds-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ds-space-4) var(--ds-space-5);
  border-bottom: 1px solid var(--ds-border);
}

.ds-drawer-body {
  flex: 1;
  overflow-y: auto;
}

.ds-notif-item {
  display: flex;
  gap: var(--ds-space-3);
  padding: var(--ds-space-4) var(--ds-space-5);
  border-bottom: 1px solid var(--ds-border);
  border-left: 3px solid transparent;
}

.ds-notif-item.ds-notif-unread {
  background: #F0F7FF;
  border-left-color: var(--ds-primary);
}

.ds-notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  background: var(--ds-primary);
}

.ds-notif-item-title {
  font-weight: 600;
  font-size: 13px;
}

.ds-notif-item-msg {
  font-size: 13px;
  color: var(--ds-text-secondary);
}

.ds-notif-item-time {
  font-size: 11px;
  color: var(--ds-text-secondary);
  margin-top: 2px;
}

/* ---- Off-canvas sidebar (mobile/tablet) -----------------------------
   #sidebar/#content live in a flex row (.wrapper). style.css hides the
   sidebar below 992px with a negative margin, but it stays IN FLOW, so
   opening it (.active) pushes #content into a sliver instead of
   overlaying it. Here it's taken out of flow (fixed) and a backdrop is
   added, so opening the menu no longer squashes the page content. */

.ds-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    margin-left: 0;
    height: 100%;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .3s ease;
    z-index: 1036;
    box-shadow: var(--ds-elevation-2);
  }

  #sidebar.active {
    margin-left: 0;
    transform: translateX(0);
  }

  #content {
    width: 100%;
  }

  .ds-sidebar-overlay.active {
    display: block;
  }

  body.ds-sidebar-open {
    overflow: hidden;
  }
}

/* ---- Responsive ---------------------------------------------------- */

@media (max-width: 991.98px) {
  .ds-tile-grid,
  .ds-kpi-row {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 575.98px) {
  .ds-tile-grid,
  .ds-kpi-row {
    grid-template-columns: 1fr;
  }

  .ds-daterange {
    padding: var(--ds-space-2) var(--ds-space-3);
  }

  .ds-daterange input[type="date"] {
    width: 100%;
  }

  .ds-drawer {
    /* the closed state (right: -420px above) is sized for the 420px
       desktop width; once width goes to 100%, that fixed offset no
       longer clears the viewport and the drawer peeks in unprompted
       on ~420-575px screens. Re-anchor the closed state to the new width. */
    width: 100%;
    max-width: 100vw;
    right: -100%;
  }

  .ds-drawer.ds-drawer-open {
    right: 0;
  }

  .navbar .container-fluid > span {
    font-size: 13px;
  }

  .navbar .container-fluid > span img {
    width: 34px !important;
    margin-right: 2px;
  }
}

/* ---- Global overflow safety net -------------------------------------
   Belt-and-braces: stops any stray fixed-width element (wide table,
   long unbroken string, etc.) from forcing the whole page to scroll
   sideways on narrow screens. */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
