/* Final dashboard layout: content-sized cards, no inherited fixed-height rows. */
@media screen {
  .dashboard-view .content { max-width: 1720px; margin-inline: auto; padding: 22px 24px 28px; background: transparent; }
  body, .app-shell .workspace { background: #eaf5fa; }
  .app-shell .content { background: transparent; }
  .dashboard-view .workspace { background: linear-gradient(145deg,#e5f4fb 0%,#eff9fb 55%,#e5f3f8 100%); }
  .dashboard-view .metric-card, .dashboard-view .dashboard-grid > .panel,
  .dashboard-view .overview-details .panel:not(.hidden) { border-color: #dce7ec; box-shadow: 0 3px 12px #24455a05; }
  .dashboard-view .page-eyebrow { display: block; font-size: 11px; letter-spacing: .14em; }
  .dashboard-view .topbar { min-height: 82px; }
  .dashboard-view .metric-grid { gap: 14px; margin: 0 0 18px; }
  .dashboard-view .metric-card { min-height: 126px; padding: 16px 15px 28px; display: grid; grid-template-columns: 34px minmax(0,1fr); grid-template-rows: auto auto auto; align-content: start; gap: 4px 10px; }
  .dashboard-view .metric-card > div:last-child { display: contents; }
  .dashboard-view .metric-icon { display: grid; grid-column: 1; grid-row: 1 / 3; width: 34px; height: 34px; }
  .dashboard-view .metric-card span { grid-column: 2; white-space: nowrap; font-size: 12px; }
  .dashboard-view .metric-card strong { grid-column: 2; white-space: nowrap; }
  .dashboard-view .metric-card small { grid-column: 1 / -1; display: block; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dashboard-view .metric-card strong { font-size: 30px; }
  .dashboard-view .metric-card small { font-size: 12px; line-height: 1.5; }
  .dashboard-view .dashboard-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); grid-template-rows: auto; align-items: stretch; gap: 16px; flex: none; }
  .dashboard-view .dashboard-grid > .panel { min-height: 0; height: auto; padding: 20px; grid-column: auto; border-radius: 16px; }
  .dashboard-view .overview-status { order: 0; }
  .dashboard-view .overview-distribution { order: 1; }
  .dashboard-view .overview-deadlines { order: 2; }
  .dashboard-view .panel-header { margin-bottom: 16px; }
  .dashboard-view .panel-header h3 { font-size: 19px; }
  .dashboard-view .status-chart-wrap { gap: 12px; }
  .dashboard-view .status-donut { width: 140px; height: 140px; }
  .dashboard-view .status-donut:before { width: 100px; height: 100px; }
  .dashboard-view .status-donut strong { font-size: 28px; }
  .dashboard-view .status-legend-row { min-height: 30px; padding: 5px 3px; font-size: 12px; }
  .dashboard-view .overview-bar { margin: 16px 0; gap: 8px; }
  .dashboard-view #department-summary, .dashboard-view #document-category-bars { max-height: 320px; overflow-y: auto; }
  .dashboard-view .deadline-list { grid-template-columns: 1fr; }
  .dashboard-view .overview-details { grid-column: 1 / -1; order: 3; display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.35fr); align-items: stretch; grid-auto-flow: row dense; gap: 16px; height: auto; }
  .dashboard-view .overview-details > .overview-attention { order: 0; grid-column: 1; }
  .dashboard-view .overview-details > .overview-recent { order: 1; grid-column: 2; }
  .dashboard-view .overview-details > .asset-overview-panel { order: 2; grid-column: 1 / -1; }
  .dashboard-view .overview-details .panel:not(.hidden) { padding: 20px; min-height: 0; border-radius: 16px; }
  .dashboard-view .attention-list { grid-template-columns: 1fr; }
  .dashboard-view .attention-item { padding: 12px; }
  .dashboard-view .attention-item small { display: block; line-height: 1.5; }
  .dashboard-view .empty-state-inline { min-height: 0; height: auto; margin: 0; padding: 14px; border-radius: 10px; background: #f1f6f8; text-align: left; line-height: 1.6; }
  .dashboard-view .overview-distribution .empty-state { min-height: 0; padding: 14px; }
  .dashboard-view .asset-overview-panel:has(#overview-assets-empty:not(.hidden)) { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
  .dashboard-view .asset-overview-panel:has(#overview-assets-empty:not(.hidden)) .panel-header { margin: 0; flex: 1; }
  .dashboard-view #overview-assets-empty { margin: 0; color: #80808d; font-size: 13px; }
  .dashboard-view .overview-deadlines { display: flex; flex-direction: column; }
  .dashboard-view .deadline-list { gap: 8px; max-height: 350px; overflow-y: auto; }
  .dashboard-view .deadline-list:has(> .empty-state-inline) { flex: 1; display: grid; align-content: center; }
  .dashboard-view #deadline-list > .empty-state-inline { text-align: center; background: transparent; color: #698798; }
  .dashboard-view #deadline-list > .empty-state-inline::before { content: '◷'; display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 18px; color: #2999b7; background: #e9f7fc; font-size: 30px; }
  .dashboard-view .dashboard-panel-note { color: #698291; font-size: 12px; line-height: 1.5; margin: 6px 0 0; text-wrap: pretty; }
  .dashboard-view .overview-recent .activity-row { min-height: 58px; }
}
@media screen and (max-width: 1279px) {
  .dashboard-view .content { padding: 20px; }
  .dashboard-view .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .dashboard-view .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-view .dashboard-grid > .overview-deadlines { grid-column: 1 / -1; }
}
@media screen {
  .dashboard-view .panel-header { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 10px; }
  .dashboard-view .panel-header > div { min-width: 0; }
  .dashboard-view .panel-header h3, .dashboard-view .panel-header .text-button,
  .dashboard-view .overview-switch .button { white-space: nowrap; }
  .dashboard-view .overview-bar > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .dashboard-view .overview-recent .activity-row > div { min-width: 0; }
  .dashboard-view .overview-recent .activity-row strong,
  .dashboard-view .overview-recent .activity-row small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dashboard-view .overview-recent .activity-row > span:last-child { white-space: nowrap; }
  .dashboard-view .deadline-subtitle, .dashboard-view .attention-item small { text-wrap: pretty; word-break: normal; overflow-wrap: normal; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-donut { width: 104px; height: 104px; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-donut:before { width: 74px; height: 74px; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-chart-wrap { grid-template-columns: 104px minmax(0,1fr); gap: 12px; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-legend-row { grid-template-columns: 7px minmax(0,1fr) 24px 34px; gap: 4px; min-height: 29px; padding: 4px 0; font-size: 11px; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-legend-heading { grid-template-columns: 7px minmax(0,1fr) 24px 34px; gap: 4px; font-size: 9px; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-legend-heading > :nth-child(2) { font-size: 0; }
  .dashboard-view .dashboard-grid:has(#deadline-list > .empty-state-inline) .status-legend-heading > :nth-child(2)::after { content: 'SL'; font-size: 9px; }
}
@media screen and (min-width: 1280px) and (max-width: 1499px) {
  .dashboard-view .panel-header h3 { font-size: 17px; }
  .dashboard-view .panel-header .text-button { font-size: 12px; padding-inline: 0; }
}
@media screen and (max-width: 980px) {
  .dashboard-view .dashboard-grid, .dashboard-view .overview-details { grid-template-columns: minmax(0,1fr); }
  .dashboard-view .dashboard-grid > .panel,
  .dashboard-view .overview-details > .panel { grid-column: 1; grid-row: auto; }
  .dashboard-view .asset-overview-panel:has(#overview-assets-empty:not(.hidden)) { display: block; }
  .dashboard-view #overview-assets-empty { margin-top: 12px; }
}

/* Water-industry palette and a genuinely compact icon rail. */
@media screen {
  .sidebar { background: linear-gradient(170deg,#104763 0%,#0c344d 65%,#092b42 100%); }
  .nav-icon { color: #9bd9ec; }
  .nav-item.active { background: #087fa6; box-shadow: inset 3px 0 #7de1ed; }
  .brand-copy span, .sidebar-user .profile-copy small { color: #b1d5e3; }
  .dashboard-view .text-button { color: #087b9f; }
  .dashboard-view .bar-fill { background: linear-gradient(90deg,#078bb7,#46bed3); }
  .dashboard-view .overview-switch [aria-pressed="true"] { color: #096b8b; background: #e4f5fb; border-color: #a9dbe9; }
  .dashboard-view .asset-value-card { background: linear-gradient(130deg,#0b5776,#098eae); }
}
@media screen and (min-width: 981px) {
  .sidebar-collapsed { --sidebar-width: 56px; }
  .sidebar-collapsed .brand { padding: 12px 6px; }
  .sidebar-collapsed .brand-logo { width: 40px; height: 31px; padding: 2px; border-radius: 7px; }
  .sidebar-collapsed .main-nav { padding: 14px 6px; gap: 5px; }
  .sidebar-collapsed .nav-item { width: 44px; min-height: 42px; padding: 8px 0; gap: 0; border-radius: 9px; }
  .sidebar-collapsed .nav-icon, .sidebar-collapsed .nav-icon svg { width: 21px; height: 21px; }
  .sidebar-collapsed .sidebar-bottom { padding: 12px 6px; }
  .sidebar-collapsed .sidebar-user { margin: 0; }
  .sidebar-collapsed .profile-button { padding: 5px; }
  .sidebar-collapsed .avatar { width: 30px; height: 30px; font-size: 12px; }
  .sidebar-collapsed .rail-toggle { width: 24px; height: 24px; right: -12px; top: 32px; color: #117293; border-color: #cbe2ed; }
}
@media screen and (max-width: 600px) {
  .dashboard-view .content { padding: 14px 12px 24px; }
  .dashboard-view .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .dashboard-view .metric-card { padding: 14px 12px 28px; }
  .dashboard-view .dashboard-grid > .panel, .dashboard-view .overview-details .panel:not(.hidden) { padding: 18px; }
}

/* Company → department → folder. Keep the search wide without an empty cell. */
@media screen {
  .document-filters [hidden] { display: none !important; }
  .document-filters .filter-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .document-filters .search-field { grid-column: auto; }
  #document-category-filter { grid-column: span 2; }
}
@media screen and (max-width: 760px) {
  .document-toolbar .toolbar-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .document-toolbar .toolbar-buttons > .button { min-height: 44px; height: auto; padding: 10px 8px; }
  .document-toolbar .toolbar-action-menu { grid-column: 1 / -1; }
  .document-filters .filter-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-filters .search-field { grid-column: 1 / -1; }
  #document-category-filter { grid-column: 1 / -1; }
  #document-status-filter { grid-column: 1 / -1; }
}
@media screen and (max-width: 480px) {
  .document-filters .filter-group { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (max-width: 360px) {
  .dashboard-view .metric-grid { grid-template-columns: minmax(0,1fr); }
  .dashboard-view .panel-header h3 { font-size: 18px; }
}

/* Header shortcuts share the title row on desktop; compact screens get an orderly second row. */
#sync-status[hidden] { display: none !important; }
.dashboard-header-links { display: none; }
@media screen {
  .dashboard-view .topbar { display: grid; grid-template-columns: minmax(180px,1fr) auto auto; align-items: center; gap: 16px; padding: 18px 28px; }
  .dashboard-view .topbar-actions { display: contents; }
  .dashboard-view .dashboard-header-links { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .dashboard-view .dashboard-header-links .button { min-height: 42px; padding: 10px 14px; border: 1px solid #dddfea; border-radius: 11px; font-size: 13px; line-height: 20px; font-weight: 700; white-space: nowrap; box-shadow: none; }
  .dashboard-view .dashboard-header-links .header-primary { color: #fff; background: #087fa6; border-color: #087fa6; }
  .dashboard-view .dashboard-header-links .header-primary:hover { background: #076b8d; border-color: #076b8d; }
  .dashboard-view .dashboard-header-links .header-secondary { color: #1c647f; background: #eff8fc; border-color: #cce4ef; }
  .dashboard-view .dashboard-header-links .header-secondary:hover { background: #def2f9; border-color: #a3d7e7; }
  .dashboard-view .dashboard-header-links .button:focus-visible { outline: 3px solid #a7afe3; outline-offset: 3px; }
  .dashboard-view .notification-bell { min-height: 42px; color: #343852; border-color: #dddfea; white-space: nowrap; box-shadow: none; }
  .dashboard-view .notification-bell-icon { border-color: #078bb7; }
  .dashboard-view .notification-bell-icon::before, .dashboard-view .notification-bell-icon::after { background: #078bb7; }
  .dashboard-view .metric-card:has(#metric-doc-active) .metric-icon { color: #6a5fbd; background: #efecfa; }
  .dashboard-view .metric-card:has(#metric-doc-missing) .metric-icon { color: #a37829; background: #fff5df; }
}
@media screen and (max-width: 1199px) {
  .dashboard-view .topbar { grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 16px 20px; }
  .dashboard-view .topbar-left { grid-column: 1; grid-row: 1; }
  .dashboard-view .notification-bell { grid-column: 2; grid-row: 1; justify-self: end; }
  .dashboard-view .dashboard-header-links { grid-column: 1 / -1; grid-row: 2; }
}
@media screen and (max-width: 600px) {
  .dashboard-view .topbar { padding: 12px; gap: 12px; }
  .dashboard-view .dashboard-header-links { flex-wrap: wrap; gap: 7px; }
  .dashboard-view .dashboard-header-links .button { min-height: 40px; padding: 9px 11px; font-size: 12px; }
}
