/*
 * ALEF HUB — friendly refinement layer.
 *
 * The legacy stylesheet still owns feature-specific mechanics. This file is
 * deliberately last in the cascade and owns the shared visual language,
 * responsive shell, typography and the most-used work surfaces.
 */

:root {
  --friendly-canvas: #f6f4ef;
  --friendly-surface: #fff;
  --friendly-surface-soft: #fbfaf6;
  --friendly-ink: #292b31;
  --friendly-muted: #6f737b;
  --friendly-subtle: #92969d;
  --friendly-line: #e5e1d8;
  --friendly-line-strong: #d9d2c4;
  --friendly-accent: #f4b63d;
  --friendly-accent-hover: #e7a72e;
  --friendly-accent-soft: #fff2cb;
  --friendly-green: #4f7b62;
  --friendly-red: #b6534b;
  --friendly-blue: #547ba3;
  --friendly-violet: #8b668a;
  --friendly-sidebar: #303238;
  --friendly-sidebar-soft: #3a3c43;
  --friendly-radius-sm: 10px;
  --friendly-radius: 16px;
  --friendly-radius-lg: 24px;
  --friendly-shadow: 0 12px 34px rgba(47, 43, 35, 0.065);
  --accent: var(--friendly-accent);
  --accent-hover: var(--friendly-accent-hover);
  --canvas: var(--friendly-canvas);
}

html {
  background: var(--friendly-canvas);
}

body {
  color: var(--friendly-ink);
  background: var(--friendly-canvas);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a,
button,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(244, 182, 61, 0.42);
  outline-offset: 2px;
}

.brand-mark {
  width: min(100%, 340px);
  height: auto;
  aspect-ratio: 356 / 122;
  margin: 0 0 42px;
}

.brand-logo {
  object-fit: contain;
  object-position: left center;
}

.hub-shell {
  grid-template-columns: 304px minmax(0, 1fr);
  background: var(--friendly-canvas);
}

.hub-sidebar {
  z-index: 30;
  padding: 24px 16px 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 20% 0%, rgba(244, 182, 61, 0.12), transparent 30%),
    var(--friendly-sidebar);
  background-size: 28px 28px, 28px 28px, auto, auto;
  box-shadow: 12px 0 34px rgba(37, 38, 42, 0.08);
}

.hub-brand {
  padding: 0 8px 20px;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.hub-brand-logo {
  display: block;
  width: 162px;
  height: auto;
  margin: 0;
  line-height: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}

.hub-brand-logo:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.hub-brand-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.hub-brand > span {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.hub-brand > span::before {
  content: "";
  width: 18px;
  height: 2px;
  flex: 0 0 auto;
  border-radius: 99px;
  background: var(--friendly-accent);
  box-shadow: 0 0 12px rgba(244, 182, 61, 0.42);
}

.hub-sidebar-toggle {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease;
}

.hub-sidebar-toggle:hover {
  transform: translateX(-1px);
}

.hub-nav {
  display: grid;
  gap: 5px;
  padding: 20px 0 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.hub-nav a {
  position: relative;
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.hub-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
  transform: translateX(2px);
}

.hub-nav a.is-current {
  border-color: rgba(255, 255, 255, 0.07);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(244, 182, 61, 0.12), transparent 68%),
    rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 8px 22px rgba(18, 18, 20, 0.08);
}

.hub-nav a.is-current::before {
  left: -17px;
  width: 3px;
  height: 24px;
  background: var(--friendly-accent);
  box-shadow: 0 0 14px rgba(244, 182, 61, 0.4);
}

.hub-nav .hub-nav-icon {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease;
}

.hub-nav-glyph {
  width: 18px;
  height: 18px;
  display: block;
}

.hub-nav .hub-nav-icon::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 4px;
  width: 6px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transform: rotate(-10deg);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.hub-nav a:hover > .hub-nav-icon {
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.hub-nav a.is-current > .hub-nav-icon {
  border-color: rgba(244, 182, 61, 0.48);
  color: #ffe09a;
  background: linear-gradient(145deg, rgba(244, 182, 61, 0.2), rgba(244, 182, 61, 0.07));
  box-shadow: 0 0 18px rgba(244, 182, 61, 0.08);
}

.hub-nav a.is-current > .hub-nav-icon::after {
  background: var(--friendly-accent);
  box-shadow: 0 0 7px rgba(244, 182, 61, 0.45);
}

.hub-nav-label {
  font-weight: 540;
  letter-spacing: 0.005em;
}

.hub-nav a > small {
  max-width: 66px;
  padding: 3px 5px;
  overflow: hidden;
  border-radius: 5px;
  color: #dbc27d;
  background: rgba(244, 182, 61, 0.08);
  font-size: 9px;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.hub-nav a > small {
  display: none;
}

.hub-nav .nav-count {
  min-width: 20px;
  height: 20px;
  display: grid;
  padding: 0 5px;
  place-items: center;
  border-radius: 99px;
  color: #352d1d;
  background: var(--friendly-accent);
  font-size: 11px;
}

.hub-nav-group-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 11px 4px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.hub-nav-group-label::before {
  content: "";
  width: 8px;
  height: 2px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: rgba(244, 182, 61, 0.8);
  transform: rotate(-10deg);
}

.sidebar-group {
  display: block;
  margin: 5px 0 11px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-group summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}

.sidebar-group summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.64);
  background: rgba(255, 255, 255, 0.04);
  font-size: 16px;
}

.sidebar-group[open] summary::after {
  content: "−";
}

.sidebar-group summary::-webkit-details-marker {
  display: none;
}

.sidebar-group > div {
  display: grid;
  gap: 1px;
  padding: 5px 0 0 10px;
}

.sidebar-group a {
  padding: 7px 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.hub-user {
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  margin-top: auto;
  padding: 16px 8px 0;
}

.hub-user strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-user span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.logout-form button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  cursor: pointer;
}

.logout-form button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.mobile-tabbar,
.mobile-nav-sheet {
  display: none;
}

.hub-main {
  width: 100%;
  padding: 0 clamp(22px, 3.2vw, 48px) 64px;
}

.hub-topbar {
  min-height: 96px;
  gap: 20px;
  border-color: var(--friendly-line);
}

.crumb {
  color: var(--friendly-subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.hub-topbar h1 {
  margin-top: 6px;
  font-size: clamp(25px, 2.3vw, 31px);
  letter-spacing: -0.035em;
}

.hub-search,
.notice-button {
  border-color: var(--friendly-line);
  border-radius: 13px;
  box-shadow: 0 4px 14px rgba(47, 43, 35, 0.035);
}

.hub-search input {
  font-size: 14px;
}

.welcome-strip,
.dashboard-intro {
  border-radius: var(--friendly-radius-lg);
  background:
    radial-gradient(circle at 88% 10%, rgba(244, 182, 61, 0.3), transparent 32%),
    linear-gradient(125deg, #34363c, #2e3036);
  box-shadow: 0 18px 42px rgba(43, 40, 35, 0.11);
}

.welcome-strip {
  min-height: 176px;
  margin-top: 26px;
  padding: 32px 36px;
}

.welcome-strip > div:first-child > span,
.dashboard-intro .section-kicker {
  color: #ffd26a;
  font-size: 11px;
  letter-spacing: 0.075em;
}

.welcome-strip h2 {
  margin: 9px 0 8px;
  font-size: clamp(28px, 3vw, 36px);
}

.welcome-strip p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
}

.setup-progress {
  width: 185px;
}

.setup-progress strong {
  font-size: 30px;
}

.setup-progress span {
  font-size: 12px;
}

.home-attention {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.home-attention > a,
.home-attention > article {
  min-width: 0;
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 3px 14px;
  padding: 18px 20px;
  border: 1px solid var(--friendly-line);
  border-radius: var(--friendly-radius);
  color: inherit;
  background: var(--friendly-surface);
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.home-attention > a:hover {
  border-color: #dfbf6d;
  box-shadow: var(--friendly-shadow);
  transform: translateY(-1px);
}

.home-attention span {
  color: var(--friendly-muted);
  font-size: 13px;
  font-weight: 600;
}

.home-attention strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: #745a20;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.home-attention small {
  color: var(--friendly-subtle);
  font-size: 12px;
}

.content-section {
  margin-top: 32px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-kicker {
  color: var(--friendly-subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: none;
}

.section-heading h2 {
  margin-top: 5px;
  font-size: 22px;
}

.section-heading > a,
.section-heading > button {
  color: var(--friendly-muted);
  font-size: 13px;
}

.systems-grid {
  gap: 14px;
}

.system-card {
  min-height: 154px;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 14px;
  padding: 21px;
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
  box-shadow: 0 3px 12px rgba(47, 43, 35, 0.025);
}

.system-code {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 12px;
}

.system-code.active {
  background: #ffd675;
}

.system-card-copy h3 {
  margin-top: 1px;
  font-size: 16px;
}

.system-card-copy p {
  min-height: 38px;
  margin-bottom: 12px;
  color: var(--friendly-muted);
  font-size: 13px;
  line-height: 1.45;
}

.system-status {
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.setup-column,
.setup-task {
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
}

.column-title h3,
.setup-task h4 {
  font-size: 13px;
}

.setup-task > span,
.setup-task small,
.setup-task i,
.column-title span {
  font-size: 12px;
}

/* Kanban: keep the soft lanes, bring the actual work above the fold. */
.kanban-main {
  padding-right: clamp(22px, 3.2vw, 48px);
}

.kanban-topbar {
  min-height: 112px;
}

.kanban-title-group {
  min-width: 0;
}

.kanban-inline-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
}

.kanban-inline-overview span {
  color: var(--friendly-muted);
  font-size: 12px;
}

.kanban-inline-overview b {
  margin-right: 3px;
  color: var(--friendly-ink);
  font-size: 14px;
}

.kanban-inline-overview .has-alert,
.kanban-inline-overview .has-alert b {
  color: var(--friendly-red);
}

.kanban-overview {
  display: none;
}

.kanban-filter-drawer > summary {
  display: none;
}

.kanban-filters {
  margin-top: 14px;
  padding: 12px;
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
  box-shadow: 0 3px 12px rgba(47, 43, 35, 0.02);
}

.kanban-filters label > span,
.task-form label > span,
.comment-form label > span,
.task-read-meta > span {
  color: var(--friendly-muted);
  font-size: 12px;
}

.kanban-filters input,
.kanban-filters select,
.task-form input,
.task-form select,
.task-form textarea,
.comment-form textarea {
  border-color: var(--friendly-line);
  border-radius: 11px;
  font-size: 14px;
}

.kanban-filters > button,
.task-form-actions button,
.comment-form button,
.primary-link {
  min-height: 42px;
  border-radius: 11px;
  font-size: 13px;
}

.kanban-action-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
}

.kanban-quick-filters {
  flex: 0 0 auto;
  margin-top: 0;
}

.kanban-quick-filters a {
  min-height: 46px;
  padding-inline: 15px;
  border-color: var(--friendly-line);
  border-radius: 12px;
  font-size: 12px;
}

.task-composer {
  min-width: 0;
  flex: 1;
  margin-top: 0;
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
}

.task-composer summary {
  min-height: 46px;
}

.task-composer summary strong {
  font-size: 13px;
}

.task-composer summary small,
.task-form-actions span {
  font-size: 12px;
}

.kanban-board {
  gap: 12px;
  margin-top: 14px;
  scroll-padding-inline: 2px;
}

.kanban-column {
  min-width: 262px;
  padding: 12px;
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
  background: #ebece8;
}

.kanban-column > header h2 {
  font-size: 13px;
}

.kanban-column > header p {
  color: var(--friendly-muted);
  font-size: 11px;
}

.kanban-card {
  padding: 15px;
  border-color: var(--friendly-line);
  border-radius: 13px;
  box-shadow: 0 4px 14px rgba(47, 43, 35, 0.035);
}

.department-chip,
.priority-chip,
.status-chip {
  min-height: 22px;
  font-size: 12px;
}

.kanban-card h3 {
  font-size: 14px;
  line-height: 1.38;
}

.kanban-card > p {
  color: var(--friendly-muted);
  font-size: 12px;
}

.task-assignee,
.task-due,
.kanban-card footer > a {
  font-size: 12px;
}

.task-assignee i {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.empty-column p {
  font-size: 12px;
}

/* Dashboard: favour a few readable signals over a wall of tiny numbers. */
.dashboard-main {
  padding-right: clamp(22px, 3.2vw, 48px);
}

.dashboard-intro {
  min-height: 146px;
  margin-top: 22px;
  padding: 27px 32px;
}

.dashboard-intro h2 {
  font-size: clamp(25px, 3vw, 34px);
}

.dashboard-intro p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.dashboard-system-progress strong {
  font-size: 33px;
}

.dashboard-system-progress > span,
.dashboard-system-progress a,
.dashboard-system-progress button {
  font-size: 11px;
}

.live-sources-grid {
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 16px;
}

.live-source-card {
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
  box-shadow: var(--friendly-shadow);
}

.live-source-brand strong {
  font-size: 14px;
}

.live-source-brand span,
.live-source-status,
.live-source-primary > span,
.live-source-primary > small,
.live-source-primary-companion span,
.live-source-primary-companion small,
.live-source-forecast-heading span,
.live-source-forecast-heading small,
.live-source-forecast-values span,
.live-source-forecast-values small,
.live-source-finance-heading span,
.live-source-finance-heading small,
.live-source-finance-values span,
.live-source-finance-values small,
.live-source-metrics span,
.live-source-metrics small,
.live-source-insights > span,
.live-source-card > footer span,
.live-source-card > footer a {
  font-size: 11px;
}

.live-source-primary > strong {
  font-size: clamp(27px, 3vw, 34px);
}

.live-source-primary > b {
  font-size: 11px;
}

.live-source-primary-companion strong {
  font-size: 25px;
}

.live-source-forecast-values strong,
.live-source-finance-values strong,
.live-source-metrics strong {
  font-size: 15px;
}

.live-source-insights > span strong {
  font-size: 13px;
}

.live-refresh-note {
  font-size: 12px;
}

.live-source-card :where(span, small, p, a, time),
.dashboard-card :where(span, small, p, a, time) {
  font-size: 12px;
}

.dashboard-stage {
  font-size: 12px;
}

.workload-row > i,
.dashboard-activity-list > a > i {
  font-size: 12px;
}

.dashboard-metrics {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.dashboard-metrics article > span,
.dashboard-metrics article > small,
.department-load-name span,
.department-load-row > b,
.department-load-row > small,
.workload-row > div span,
.workload-row > p span,
.risk-row > div span,
.risk-row time,
.completion-total span,
.completion-note,
.dashboard-activity-list p,
.dashboard-activity-list span,
.dashboard-activity-list time,
.dashboard-empty {
  font-size: 11px;
}

.department-load-name strong,
.workload-row > div strong,
.risk-row > div strong,
.comment-item strong {
  font-size: 12px;
}

.workload-row > b,
.risk-row > b {
  font-size: 10px;
}

.dashboard-card {
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
}

/* Documents: three clear steps on desktop, one safe sequence on mobile. */
.document-hub-main {
  padding-inline: clamp(18px, 2.4vw, 34px);
}

.document-workspace {
  grid-template-columns: 230px minmax(420px, 1fr) 220px;
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius-lg);
  box-shadow: var(--friendly-shadow);
}

.document-library,
.document-controls {
  padding: 22px 18px;
}

.document-panel-heading > span,
.document-panel-heading p,
.document-asset-form label strong,
.document-asset-form label small,
.document-asset-choice span,
.document-asset-choice small,
.document-assets-empty p,
.document-security-note p,
.document-stage-toolbar strong,
.document-stage-toolbar span,
.document-stage-toolbar a,
.document-upload-form label > p,
.document-upload-form label > small,
.document-upload-form label > b,
.document-page-footer span,
.document-control-hint,
.document-text-controls label,
.document-control-group button,
.document-export-actions button,
.document-export-actions > small,
.document-export-actions > p {
  font-size: 12px;
}

.document-panel-heading h2 {
  font-size: 17px;
}

.document-asset-form select,
.document-text-controls textarea,
.document-text-controls input {
  font-size: 14px;
}

.document-upload-form {
  min-height: 520px;
  padding: 28px;
}

.document-upload-form label {
  min-height: 460px;
  border-radius: 14px;
}

.document-upload-form label > strong {
  font-size: 16px;
}

.document-control-group button,
.document-export-actions button {
  min-height: 42px;
  border-radius: 10px;
}

.document-control-group button:disabled,
.document-export-actions button:disabled {
  color: #9b9da2;
  background: #f6f5f1;
  opacity: 0.72;
}

/* Empty and supporting states should reassure instead of looking unfinished. */
.notifications-card {
  border-color: var(--friendly-line);
  border-radius: var(--friendly-radius);
}

.notifications-empty {
  min-height: 250px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 38px 24px;
  border-top: 1px solid var(--friendly-line);
  color: var(--friendly-muted);
  text-align: center;
}

.notifications-empty > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--friendly-green);
  background: #eaf4ed;
  font-size: 21px;
}

.notifications-empty h2 {
  margin: 6px 0 0;
  color: var(--friendly-ink);
  font-size: 19px;
}

.notifications-empty p {
  max-width: 420px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.notifications-summary span,
.notifications-summary p,
.notifications-summary > a,
.notifications-summary > button {
  font-size: 13px;
}

@media (min-width: 901px) {
  .hub-shell.is-sidebar-collapsed {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .hub-shell.is-sidebar-collapsed .hub-sidebar {
    padding-inline: 10px;
  }

  .hub-shell.is-sidebar-collapsed .hub-brand-logo,
  .hub-shell.is-sidebar-collapsed .hub-brand > span,
  .hub-shell.is-sidebar-collapsed .sidebar-group,
  .hub-shell.is-sidebar-collapsed .hub-nav-label,
  .hub-shell.is-sidebar-collapsed .hub-nav a > small,
  .hub-shell.is-sidebar-collapsed .hub-nav-group-label,
  .hub-shell.is-sidebar-collapsed .hub-user > div:not(.user-avatar) {
    display: none;
  }

  .hub-shell.is-sidebar-collapsed .hub-nav a {
    grid-template-columns: 30px;
    justify-content: center;
    padding-inline: 0;
  }
}

@media (max-width: 1250px) and (min-width: 901px) {
  .hub-shell {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .hub-brand-logo {
    width: 128px;
  }

  .hub-brand > span {
    font-size: 10px;
  }

  .hub-main {
    padding-inline: 26px;
  }

  .document-workspace {
    grid-template-columns: 210px minmax(360px, 1fr);
  }

  .document-controls {
    position: static;
    grid-column: 1 / -1;
    width: auto;
    max-height: none;
    border: 0;
    border-top: 1px solid var(--friendly-line);
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 1080px) and (min-width: 901px) {
  .systems-grid,
  .home-attention {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-attention > :last-child {
    grid-column: 1 / -1;
  }

  .live-sources-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hub-shell,
  .hub-shell.is-sidebar-collapsed {
    display: block;
    min-height: 100vh;
  }

  .hub-sidebar {
    display: none;
  }

  .hub-main,
  .kanban-main,
  .dashboard-main,
  .document-hub-main,
  .mail-main,
  .notifications-main,
  .payments-main,
  .backups-main,
  .accesses-main,
  .servers-main,
  .users-main,
  .directories-main {
    width: 100%;
    padding: 0 18px 88px;
    overflow: visible;
  }

  .hub-topbar {
    min-height: auto;
    padding: 20px 0 17px;
  }

  .hub-topbar h1 {
    font-size: 25px;
  }

  .mobile-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    min-height: 64px;
    padding: 5px 6px max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(48, 50, 56, 0.98);
    box-shadow: 0 -10px 28px rgba(36, 34, 31, 0.16);
    backdrop-filter: blur(14px);
  }

  .mobile-tabbar > a,
  .mobile-tabbar > button {
    position: relative;
    min-width: 0;
    min-height: 52px;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 0 3px;
    border: 0;
    border-radius: 11px;
    color: rgba(255, 255, 255, 0.66);
    background: transparent;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
  }

  .mobile-tabbar > a.is-current {
    color: #ffe19a;
    background: rgba(244, 182, 61, 0.11);
  }

  .mobile-nav-symbol {
    min-height: 22px;
    display: grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
  }

  .mobile-nav-label {
    max-width: 100%;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-tabbar .nav-count {
    position: absolute;
    top: 3px;
    left: 50%;
    min-width: 18px;
    height: 18px;
    display: grid;
    margin-left: 8px;
    padding: 0 4px;
    place-items: center;
    border-radius: 99px;
    color: #302b20;
    background: var(--friendly-accent);
    font-size: 10px;
  }

  .mobile-nav-sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-top: 36px;
    background: rgba(32, 33, 37, 0.46);
    backdrop-filter: blur(3px);
  }

  .mobile-nav-sheet[hidden] {
    display: none;
  }

  .mobile-nav-panel {
    width: min(100%, 620px);
    max-height: calc(100vh - 36px);
    padding: 20px 18px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    background: #fff;
    box-shadow: 0 -24px 60px rgba(32, 30, 27, 0.2);
  }

  .mobile-nav-panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
  }

  .mobile-nav-panel > header span {
    color: var(--friendly-subtle);
    font-size: 11px;
  }

  .mobile-nav-panel > header h2 {
    margin: 3px 0 0;
    font-size: 22px;
  }

  .mobile-nav-panel > header button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--friendly-line);
    border-radius: 14px;
    color: var(--friendly-muted);
    background: var(--friendly-surface-soft);
    font-size: 23px;
  }

  .mobile-nav-panel > nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .mobile-nav-panel > nav a {
    min-width: 0;
    min-height: 58px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--friendly-line);
    border-radius: 14px;
    color: var(--friendly-ink);
    background: var(--friendly-surface-soft);
    text-decoration: none;
  }

  .mobile-nav-panel > nav a.is-current {
    border-color: #e4c775;
    background: var(--friendly-accent-soft);
  }

  .mobile-nav-panel > nav .mobile-nav-label {
    font-size: 13px;
  }

  .mobile-nav-panel .nav-count {
    min-width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: var(--friendly-accent);
    font-size: 11px;
  }

  .mobile-departments {
    margin-top: 14px;
    border-top: 1px solid var(--friendly-line);
    border-bottom: 1px solid var(--friendly-line);
  }

  .mobile-departments summary {
    min-height: 50px;
    display: flex;
    align-items: center;
    color: var(--friendly-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-departments > div {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-bottom: 14px;
  }

  .mobile-departments a {
    padding: 7px 10px;
    border-radius: 99px;
    color: var(--friendly-muted);
    background: #f0eee8;
    font-size: 12px;
    text-decoration: none;
  }

  .mobile-logout {
    width: 100%;
    min-height: 44px;
    margin-top: 14px;
    border: 0;
    border-radius: 12px;
    color: var(--friendly-muted);
    background: #f1efea;
    font-weight: 700;
  }

  .has-mobile-nav-open {
    overflow: hidden;
  }

  .home-attention,
  .systems-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
  }

  .setup-progress {
    width: 100%;
  }

  .kanban-topbar,
  .dashboard-topbar,
  .document-topbar {
    align-items: flex-start;
  }

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

  .kanban-action-row {
    flex-direction: column;
  }

  .kanban-quick-filters,
  .task-composer {
    width: 100%;
  }

  .task-composer summary {
    grid-template-columns: 30px auto minmax(0, 1fr);
  }

  .dashboard-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .live-sources-grid {
    grid-template-columns: 1fr;
  }

  .document-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 16px;
  }

  .document-library,
  .document-stage,
  .document-controls {
    grid-column: 1;
  }

  .document-library {
    border-right: 0;
    border-bottom: 1px solid var(--friendly-line);
  }

  .document-controls {
    position: static;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--friendly-line);
    border-radius: 0;
    box-shadow: none;
  }

  .document-stage {
    min-height: 420px;
  }

  .document-upload-form {
    min-height: 410px;
    padding: 20px;
  }

  .document-upload-form label {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .hub-main,
  .kanban-main,
  .dashboard-main,
  .document-hub-main,
  .mail-main,
  .notifications-main,
  .payments-main,
  .backups-main,
  .accesses-main,
  .servers-main {
    padding-inline: 14px;
  }

  .hub-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .hub-topbar .topbar-actions {
    width: 100%;
  }

  .hub-topbar h1 {
    font-size: 23px;
  }

  .notice-button {
    display: none;
  }

  .welcome-strip {
    min-height: 0;
    margin-top: 16px;
    padding: 25px 22px;
    border-radius: 20px;
  }

  .welcome-strip h2 {
    font-size: 28px;
  }

  .home-attention,
  .systems-grid {
    grid-template-columns: 1fr;
  }

  .home-attention > :last-child {
    grid-column: auto;
  }

  .home-attention > a,
  .home-attention > article {
    min-height: 88px;
  }

  .system-card {
    min-height: 132px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .kanban-topbar {
    padding-bottom: 14px;
  }

  .kanban-topbar .topbar-actions {
    justify-content: stretch;
  }

  .kanban-topbar .primary-link {
    width: 100%;
    justify-content: center;
  }

  .kanban-inline-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .kanban-inline-overview span {
    display: flex;
    flex-direction: column;
    padding: 9px;
    border: 1px solid var(--friendly-line);
    border-radius: 11px;
    background: #fff;
    font-size: 12px;
  }

  .kanban-filter-drawer {
    margin-top: 12px;
    border: 1px solid var(--friendly-line);
    border-radius: var(--friendly-radius);
    background: #fff;
  }

  .kanban-filter-drawer > summary {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 15px;
    cursor: pointer;
    list-style: none;
  }

  .kanban-filter-drawer > summary::-webkit-details-marker {
    display: none;
  }

  .kanban-filter-drawer > summary span {
    font-size: 14px;
    font-weight: 700;
  }

  .kanban-filter-drawer > summary small {
    color: var(--friendly-subtle);
    font-size: 11px;
  }

  .kanban-filter-drawer[open] > summary {
    border-bottom: 1px solid var(--friendly-line);
  }

  .kanban-filters {
    grid-template-columns: 1fr;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .kanban-quick-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kanban-quick-filters a {
    justify-content: center;
  }

  .task-composer summary small {
    display: none;
  }

  .task-create-grid,
  .task-edit-grid,
  .task-read-view {
    grid-template-columns: 1fr;
  }

  .dashboard-intro,
  .dashboard-card {
    padding: 21px;
  }

  .dashboard-intro h2 {
    font-size: 27px;
  }

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

  .live-source-primary.has-companion {
    grid-template-columns: 1fr;
  }

  .live-source-primary-companion {
    grid-column: 1;
    grid-row: auto;
    margin-top: 12px;
    padding: 12px 0 0;
    border-top: 1px solid var(--friendly-line);
    border-left: 0;
  }

  .document-assets-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-page-area {
    display: block;
  }

  .document-page-thumbnails {
    width: auto;
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--friendly-line);
  }

  .document-canvas-scroller {
    padding: 14px;
  }

  .mobile-nav-panel > nav {
    grid-template-columns: 1fr;
  }

  .notifications-summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Supporting screens keep the same readable baseline as the core hub. */
.payments-main :where(span, small, p, time, th, td, em, code),
.servers-main :where(span, small, p, time, th, td, em, code),
.accesses-main :where(span, small, p, time, th, td, em, code),
.backups-main :where(span, small, p, time, th, td, em, code),
.users-main :where(span, small, p, time, th, td, em, code),
.directories-main :where(span, small, p, time, th, td, em, code) {
  font-size: 12px !important;
  line-height: 1.45;
}

.payments-main .payment-scope-switch a,
.payments-main .finance-composer summary strong,
.servers-main .finance-composer summary strong,
.accesses-main .finance-composer summary strong,
.backups-main .finance-composer summary strong,
.servers-main .server-empty strong,
.accesses-main .vault-alert strong,
.accesses-main .server-empty strong,
.backups-main .server-empty strong {
  font-size: 13px !important;
}

.payments-main .calendar-navigation a,
.payments-main .finance-empty strong,
.accesses-main .access-empty strong,
.backups-main .finance-empty strong,
.backups-main .backup-table td > strong,
.users-main .admin-form h3,
.users-main .admin-form .access-option strong {
  font-size: 12px !important;
}

.users-main .user-profile-copy > strong,
.users-main .user-profile-role > strong,
.users-main .user-profile-role em,
.users-main .presence-status,
.users-main .access-badge,
.users-main .user-edit-button,
.users-main .user-impersonate-button,
.users-main .admin-form label,
.users-main .admin-form button {
  font-size: 12px;
}

.users-main .admin-form input,
.users-main .admin-form select,
.users-main .admin-form textarea,
.payments-main .finance-form input,
.payments-main .finance-form select,
.payments-main .finance-form textarea,
.servers-main .finance-form input,
.servers-main .finance-form select,
.servers-main .finance-form textarea,
.accesses-main .finance-form input,
.accesses-main .finance-form select,
.accesses-main .finance-form textarea,
.backups-main .finance-form input,
.backups-main .finance-form select,
.backups-main .finance-form textarea {
  font-size: 14px;
}

.payments-main .primary-link,
.servers-main .primary-link,
.accesses-main .primary-link,
.backups-main .primary-link,
.payments-main .finance-form-actions button,
.servers-main .finance-form-actions button,
.accesses-main .finance-form-actions button,
.backups-main .finance-form-actions button {
  font-size: 13px;
}

.mail-main .mail-pilot-status span,
.mail-main .mail-pilot-status strong,
.mail-main .mail-empty-state p,
.mail-main .mail-pilot-summary :where(span, small),
.server-empty p {
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .payments-main .payment-calendar-card,
  .payments-main .finance-table-card,
  .payments-main .finance-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .payments-main .payment-calendar,
  .payments-main .finance-table {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
