/* Shared screen presentation for every authenticated Web Admin role.
 * Feature grids, routes, grants, financial/PIN actions and printed receipts keep
 * their existing owners. Local fonts remove dependence on a third-party CDN. */
@font-face { font-family: 'Kolshi Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Kolshi Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Kolshi Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Kolshi Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-Bold.ttf') format('truetype'); font-weight: 700 900; font-style: normal; font-display: swap; }

@media screen {
  :root {
    --admin-font: 'Kolshi Arabic', 'Segoe UI', system-ui, sans-serif;
    --ui-canvas: #f5f6f8; --ui-paper: #fff; --ui-soft: #f8f9fb; --ui-soft-2: #f0f2f5;
    --ui-ink: #1d2939; --ui-ink-2: #344054; --ui-muted: #667085;
    --ui-stroke: #e4e7ec; --ui-stroke-strong: #d0d5dd;
    --ui-radius-sm: 8px; --ui-radius: 10px; --ui-radius-lg: 12px; --ui-radius-xl: 16px;
    --ui-shadow: none; --ui-shadow-lift: 0 8px 28px rgb(16 24 40 / 10%);
    --border-color: var(--ui-stroke); --text-primary: var(--ui-ink);
    --text-secondary: var(--ui-muted); --card-bg: var(--ui-paper);
    --bg-secondary: var(--ui-soft);
  }
  body.dark-mode {
    --ui-canvas: #12161c; --ui-paper: #1b222c; --ui-soft: #202935; --ui-soft-2: #283342;
    --ui-ink: #f2f4f7; --ui-ink-2: #d0d5dd; --ui-muted: #a4afbf;
    --ui-stroke: #344054; --ui-stroke-strong: #475467;
    --ui-primary: #f08096; --ui-primary-hover: #f49bad;
    --ui-primary-pale: #39252f; --ui-primary-line: #633746;
    --border-color: var(--ui-stroke); --text-primary: var(--ui-ink);
    --text-secondary: var(--ui-muted); --card-bg: var(--ui-paper); --bg-secondary: var(--ui-soft);
  }
  body { font-family: var(--admin-font); font-size: 14px; line-height: 1.6; }
  /* The legacy universal Cairo declaration used to override inherited text. */
  body * { font-family: inherit; }
  body :is(input, select, textarea, button) { font-family: var(--admin-font); }
  body :is(h1, h2, h3, h4, h5, h6) { letter-spacing: 0; font-weight: 600; line-height: 1.5; }
  body :is(.dashboard-container, .accounting-manager-dashboard, .modal, #operations-details-layer) { font-family: var(--admin-font); font-size: 14px; line-height: 1.6; }

  body .topbar { min-height: 64px; height: auto; padding: 10px 22px; gap: 16px; box-shadow: none; }
  body .topbar-left, body .topbar-end { gap: 12px; min-width: 0; }
  body .topbar-left { flex: 1 1 auto; }
  body .topbar-end { flex: 0 1 auto; }
  body .topbar .user-info { min-width: 0; gap: 10px; padding-inline-start: 12px; }
  body .topbar .user-details { min-width: 0; max-width: 200px; gap: 2px; }
  body .topbar .admin-email { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 12px; font-weight: 500; line-height: 1.4; }
  body .topbar .admin-role { font-size: 11px; font-weight: 400; line-height: 1.4; }
  body .topbar .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 15px; border-radius: 9px; }
  body .topbar .topbar-context { display: none; }
  body .page-breadcrumb { font-size: 13px; font-weight: 500; line-height: 1.5; }
  /* Keep the semantic page h1 for accessibility; its visible title is in content. */
  body .topbar .page-heading h1 { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  body .kolshi-command-trigger { min-height: 36px; min-width: 148px; padding: 6px 10px; font-size: 12px; font-weight: 400; border-radius: 8px; background: var(--ui-paper); }
  body .kolshi-command-trigger kbd { font-size: 10px; }
  body .content-area { padding: 22px 24px 32px; }
  body .tab-content { max-width: 1600px; }

  body .card, body .settings-accordion { border-radius: 12px; box-shadow: none; margin-block-end: 16px; }
  body .card-header { padding: 16px 18px; background: var(--ui-paper); gap: 12px; }
  body .card-header h3 { font-size: 17px; font-weight: 600; }
  body .card-header p { font-size: 13px; font-weight: 400; }
  body .kolshi-page-hero { min-height: 0; padding: 0 0 18px; margin-block-end: 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  body :is(#tab-finance, #tab-support-dashboard) > .kolshi-page-hero { min-height: 0; }
  body .kolshi-page-hero::before, body .kolshi-page-hero::after, body .kolshi-hero-eyebrow, body .kolshi-hero-emblem { display: none; }
  body .kolshi-hero-copy { max-width: 100%; }
  body .kolshi-page-hero h2 { font-size: 24px; font-weight: 600; margin: 0; color: var(--ui-ink); }
  body .kolshi-page-hero p { font-size: 14px; font-weight: 400; color: var(--ui-muted); margin-block-start: 6px; }

  body #dashboard-container .content-area :is(.btn-primary, .btn-secondary, .btn-save, .btn-danger, .btn-report-action),
  body .modal :is(.btn-primary, .btn-secondary, .btn-save, .btn-danger),
  body .accounting-manager-dashboard :is(.btn-primary, .btn-secondary, .btn-save) {
    min-height: 38px; padding: 7px 13px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 1.5; box-shadow: none; gap: 7px;
  }
  body #dashboard-container .content-area :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea),
  body .modal :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea),
  body .accounting-manager-dashboard :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea) {
    min-height: 40px; padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 400; line-height: 1.5; background-color: var(--ui-paper); color: var(--ui-ink); box-shadow: none;
  }
  body :is(.content-area, .modal, .accounting-manager-dashboard) :is(input, textarea)::placeholder { color: #8792a2; opacity: 1; font-weight: 400; }
  body #dashboard-container .content-area textarea, body .modal textarea { min-height: 96px; }
  body :is(.content-area, .modal, .accounting-manager-dashboard) :is(input, select, textarea):focus-visible { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
  body :is(.content-area, .modal, .accounting-manager-dashboard) :is(label, .form-label) { font-size: 13px; font-weight: 500; line-height: 1.6; }
  body :is(.data-table, .finance-v5-table, .am-table, .support-movement-table) :is(th, td) { padding: 11px 14px; font-size: 13px; line-height: 1.6; }
  body :is(.data-table, .finance-v5-table, .am-table) th { font-weight: 500; color: var(--ui-muted); background: var(--ui-paper); }
  body :is(.data-table, .finance-v5-table, .am-table) td { font-variant-numeric: tabular-nums; }

  /* 320px navigation + flexible content = viewport; no page scaling. */
  body .dashboard-container > .sidebar { width: 320px; flex-basis: 320px; }
  body .sidebar { scrollbar-width: thin; }
  body .sidebar .nav-links li[data-tab] { min-height: 48px; padding: 11px 14px; border-radius: 8px; font-size: 16px; font-weight: 500; line-height: 1.6; }
  body .sidebar .nav-links li[data-tab].active { background: #2b3545; border-color: transparent; color: #fff; box-shadow: inset -3px 0 #e64963; }
  body .sidebar .nav-links li[data-tab]::before, body .sidebar .nav-links li[data-tab]::after { display: none; }
  body .sidebar .nav-links li[data-tab='users'], body .sidebar .nav-links li[data-tab='finance'] { margin-block-start: 3px; }
  body .sidebar .nav-section { padding: 12px 18px 4px; letter-spacing: 0; font-size: 11px; font-weight: 400; }
  body .sidebar-workspace strong { font-size: 13px; font-weight: 500; }
  body .sidebar-workspace small { font-size: 11px; font-weight: 400; }
  body .sidebar .sidebar-header, body .sidebar.root-enterprise-sidebar .sidebar-header { min-height: 76px; padding: 16px; }
  body .sidebar .sidebar-header h2 { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 20px; font-weight: 700; }
  body .sidebar .sidebar-brand-name > span { font-family: var(--admin-font); font-size: 12px; font-weight: 400; }
  body .sidebar .sidebar-header .logo-mini { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; }
  body #enterprise-sidebar-navigation .enterprise-workspace-picker { padding: 10px 12px 16px; font-size: 13px; font-weight: 400; }
  body #enterprise-sidebar-navigation .enterprise-workspace-picker select { min-height: 44px; font-size: 15px; font-weight: 500; border-radius: 8px; }
  body #enterprise-sidebar-navigation summary, body .sidebar.root-enterprise-sidebar #enterprise-sidebar-navigation summary { min-height: 50px; padding: 12px; font-size: 16px; font-weight: 500; }
  body #enterprise-sidebar-navigation .enterprise-nav-icon { width: 22px; height: 22px; flex-basis: 22px; }
  body #enterprise-sidebar-navigation .enterprise-section-link, body .sidebar #enterprise-sidebar-navigation li[data-tab] { min-height: 46px; padding: 11px 14px; font-size: 15px; font-weight: 400; }
  body #enterprise-sidebar-navigation .enterprise-section-link[aria-current='page'], body .sidebar #enterprise-sidebar-navigation li[data-tab].active { font-weight: 600; }
  body .sidebar.root-enterprise-sidebar [data-root-account] { padding: 10px; gap: 3px; }
  body .sidebar.root-enterprise-sidebar [data-root-account] strong { font-size: 12px; font-weight: 500; }
  body .sidebar.root-enterprise-sidebar [data-root-account] > span { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 11px; }
  body .sidebar.root-enterprise-sidebar .root-account-settings { min-height: 32px; padding: 4px 0; font-size: 12px; }

  body #enterprise-root .enterprise-card { padding: 22px; }
  body #enterprise-root .enterprise-page-header { margin-block-end: 20px; }
  body #enterprise-root .enterprise-page-header h2 { font-size: 24px; font-weight: 600; }
  body #enterprise-root .enterprise-page-header .enterprise-breadcrumb { display: none; }
  body #enterprise-root .enterprise-scope-panel { padding: 14px 16px; margin-block-end: 18px; border-radius: 9px; }
  body #enterprise-root .enterprise-scope-toolbar { gap: 16px; }
  body #enterprise-root .enterprise-scope-toolbar > label { flex: 0 1 280px; max-width: 340px; font-size: 13px; font-weight: 500; gap: 7px; }
  body #enterprise-root .enterprise-page-search { margin-block: 14px; }
  body #enterprise-root .enterprise-form { padding: 18px; gap: 18px; background: var(--ui-paper); border-radius: 10px; }
  body #enterprise-root :is(th, td) { padding: 11px 14px; font-size: 13px; font-weight: 400; }
  body #enterprise-root th { font-weight: 500; color: var(--ui-muted); }
  body #enterprise-root .enterprise-setup p, body #enterprise-root [data-enterprise-table] > p, body #enterprise-root [data-enterprise-status] { font-size: 14px; font-weight: 400; line-height: 1.8; }
  body #enterprise-root .enterprise-empty-summary { padding: 24px 18px; background: var(--ui-soft); border-radius: 9px; }
  body #enterprise-root .enterprise-empty-summary h3 { margin: 0 0 6px; font-size: 17px; font-weight: 500; }
  body #enterprise-root .enterprise-empty-summary p { margin: 0; color: var(--ui-muted); font-size: 14px; line-height: 1.8; }
  body #enterprise-root .enterprise-summary-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-block-start: 14px; color: var(--ui-muted); font-size: 12px; }
  body #enterprise-root .enterprise-summary-meta summary { cursor: pointer; }
  body #enterprise-root .enterprise-summary-meta details p { max-width: 640px; padding-block: 10px; font-size: 13px; }
  body .settings-accordion .accordion-header { padding: 14px 18px; background: var(--ui-paper); color: var(--ui-ink); }
  body .settings-accordion .accordion-header.open { background: var(--ui-soft); color: var(--ui-ink); }
  body .settings-sync-bar { padding: 10px 14px; font-size: 13px; }
  body .am-header { padding: 16px; border-radius: 12px; box-shadow: none; }
  body .am-brand h1 { font-size: 22px; font-weight: 600; }
  body .am-brand p { font-size: 13px; font-weight: 400; }
  body .am-header nav { gap: 4px; }
  body .am-header nav button { min-height: 38px; padding: 8px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; }
  body .am-header nav button.active { color: var(--ui-primary); background: var(--ui-primary-pale); }
  body .finance-v5-hero h3 { font-size: 20px; font-weight: 500; }
  body :is(.finance-v5-rail-btn, .finance-v5-tab-btn) { min-height: 38px; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; box-shadow: none; }
  body .finance-v5-summary-card .value { font-weight: 600; }
  body .am-metric.info strong { color: var(--ui-ink); }
  body .am-metric.positive strong { color: var(--ui-green); }
  body .am-metric.negative strong { color: var(--ui-danger); }

  @media (max-width: 1200px) {
    body .dashboard-container > .sidebar { width: 296px; flex-basis: 296px; }
    body .topbar .user-details { max-width: 150px; }
    body .kolshi-command-trigger { min-width: 120px; }
    body .topbar { padding-inline: 18px; }
  }
  @media (max-width: 768px) {
    body .dashboard-container > .sidebar { width: min(320px, 90vw); flex-basis: auto; }
    body .topbar { min-height: 60px; padding: 8px 14px; }
    body .topbar .user-info { padding-inline-start: 8px; }
    body .topbar .user-details { display: none; }
    body .topbar-end { flex: 0 0 auto; }
    body .kolshi-command-trigger { min-width: 36px; min-height: 36px; width: 36px; padding: 8px; }
    body .kolshi-command-trigger > span, body .kolshi-command-trigger kbd { display: none; }
    body .page-breadcrumb { font-size: 12px; }
    body .content-area { padding: 18px 14px 28px; }
    body #enterprise-root .enterprise-card { padding: 18px; }
    body .kolshi-page-hero h2, body #enterprise-root .enterprise-page-header h2 { font-size: 22px; }
    body #dashboard-container .content-area :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea), body .modal :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea) { min-height: 44px; font-size: 16px; }
    body #dashboard-container .content-area :is(.btn-primary, .btn-secondary, .btn-save, .btn-danger), body #enterprise-sidebar-navigation summary, body #enterprise-sidebar-navigation .enterprise-section-link { min-height: 44px; }
    body #enterprise-root .enterprise-scope-toolbar > label { flex: 1 1 220px; max-width: none; }
  }
}
