/* RCC skin for the SFTPGo WebClient (loaded after the stock styles via
   branding.web_client.extra_css). Colours are the RCC Material tokens from
   rcc-brand.css (canonical styles/rcc-brand.css; docs/design-system.md):
   RCC Home look (deep navy), Inter stack, panel radius/shadow language. Selectors stay
   defensive: SFTPGo uses KeenThemes/Bootstrap class names, so rules target
   stable Bootstrap primitives and degrade harmlessly if upstream markup
   changes. */
@import url("rcc-brand.css");

:root {
  /* The RCC Material tokens come from rcc-brand.css (canonical
     styles/rcc-brand.css), which already maps --navy, --cyan, --ink and the
     other short names onto them. Only SFTPGo's Bootstrap accent variables
     are pointed at the same tokens here, so Files never carries a second,
     older palette (operator 2026-11-17: the colours must match RCC). */
  /* The RCC Home look that RCC Home, sign-in, My RCC and Analysis share
     (roles/rcc_admin/files/app/static/rcc-shell.css "Home look"): a white top
     bar with the deep-navy wordmark and a light blue highlight. rcc-dark.css
     replaces these in the browser's dark mode. */
  --rcc-navy: #17477e;
  --rcc-navy-2: #24528d;
  --rcc-cyan: #41689c;
  --rcc-cyan-light: #eaf1fb;
  --rcc-cyan-strong: #315a97;
  --rcc-topbar-surface: var(--rcc-paper);
  --rcc-border-topbar: #dfe3e8;
  --rcc-home-divider: #d0d5da;
  --bs-primary: var(--rcc-navy);
  --bs-primary-rgb: 23, 71, 126;
  --bs-link-color: var(--rcc-navy);
  --bs-link-color-rgb: 23, 71, 126;
  --bs-link-hover-color: var(--rcc-navy-2);
  --bs-link-hover-color-rgb: 36, 82, 141;
}

/* SFTPGo follows the browser's light/dark setting (data-bs-theme). The RCC
   site switch rcc_web_color_scheme picks the second stylesheet: rcc-light.css
   collapses that dark state to the light RCC tokens (the default), and
   rcc-dark.css gives it the RCC dark tokens ("system"). See
   docs/design-system.md, dark scheme. */

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--background);
}

/* Login/auth panel: RCC card language (white surface, 20px radius, lg shadow).
   Upstream pins .bg-body, .rounded, and .shadow-sm with !important, so the
   restyle must use !important on exactly these three properties — the one
   place !important is legitimate in this file. */
.app-blank .bg-body.rounded,
#app_root .bg-body.rounded {
  background-color: var(--paper) !important;
  border: 1px solid var(--rcc-line);
  border-radius: 20px !important;
  box-shadow: var(--rcc-shadow) !important;
}

/* Branding logo on the login card: the UK-Essen wordmark is very wide
   (viewBox ~1653×425), and upstream forces a fixed 80-100px height, which
   overflows its col-5 into the brand-name column. Constrain to the column
   width and let the aspect ratio set the height. Upstream's h-*px utilities
   are !important, so height:auto must be too. */
.app-blank img[src*="/branding/"],
#app_root img[src*="/branding/"] {
  max-width: 100%;
  height: auto !important;
}

/* Headings and brand name next to the logo (upstream .text-gray-900 is
   !important, so the navy override must be too — see the note above). */
.text-gray-900,
.app-blank h1,
#app_root h1 {
  color: var(--navy) !important;
}

/* Primary buttons (sign in / OpenID account button) in RCC navy. */
.btn-primary,
.btn-check:checked + .btn.btn-primary,
.btn.btn-primary:hover,
.btn.btn-primary:focus,
.btn.btn-primary:active {
  background-color: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.btn.btn-primary:hover,
.btn.btn-primary:focus,
.btn.btn-primary:active {
  background-color: var(--navy-2);
  border-color: var(--navy-2);
}

.btn {
  border-radius: 11px;
  font-weight: 700;
}

/* The OIDC sign-in button is the single primary action on the files portal;
   render it as a navy primary even in its outline variant. */
.btn-outline.btn-active-color-primary,
.bg-state-light.btn-outline {
  border-color: var(--navy);
  color: var(--navy);
}

.btn-outline.btn-active-color-primary:hover,
.bg-state-light.btn-outline:hover {
  background-color: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

/* Links follow the RCC link color, cyan on hover. */
.link-primary,
.link-primary:hover,
a {
  color: var(--navy-2);
}

a:hover,
.link-primary:focus {
  color: var(--cyan-strong);
}

/* Inputs: RCC form language (10px radius, cyan focus ring). */
.form-control,
.form-select {
  border-color: var(--rcc-input-border);
  border-radius: 10px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 .25rem var(--rcc-focus-ring);
}

/* Focus visibility in the RCC accent for keyboard users. */
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Login page guidance. SFTPGo renders the WebClient login from a fixed
   upstream template whose only text hooks are i18n keys with predefined
   positions; there is no subtitle or footer-link key (checked against
   v2.7.1 templates/common/login.html). The supporting line and the account
   help note are therefore pure-CSS text scoped to #sign_in_form, which
   exists only on the login page. CSS cannot render hyperlinks, so the note
   names the RCC home page in words. RCC sign-in is passkey-only: no copy may
   mention a password or an authenticator code (2026-11-02 usability review). */
#sign_in_form .text-center::after {
  content: "Sign in with your RCC passkey.";
  display: block;
  margin-top: 1rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
}

#sign_in_form::after {
  content: "No account yet? Your RCC approver sends you an invitation · No working passkey? An RCC administrator gives you a new activation slip.";
  display: block;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}

/* The one sign-in button. The reviewed translation.json says the same, but
   it is only applied where the locale file is mounted; this keeps the label
   right on every deployment. */
#sign_in_form a[href*="/web/oidc"] span[data-i18n="login.signin_openid"] {
  color: transparent;
  font-size: 0;
}
#sign_in_form a[href*="/web/oidc"] span[data-i18n="login.signin_openid"]::after {
  content: "Sign in with your RCC account";
  color: #fff;
  font-size: 1rem;
}

/* ---- Authenticated shell: RCC component language on stable Bootstrap
   primitives (no shell-template anchors; degrade harmlessly). ---- */

/* Secondary actions follow the RCC secondary-button pattern. */
.btn-secondary,
.btn-outline-secondary {
  background-color: var(--paper);
  border-color: var(--line);
  color: var(--navy);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan-strong);
  background-color: var(--paper);
}

/* Cards and dialogs: RCC card radius and small shadow. */
.card,
.modal-content,
.dropdown-menu {
  border-color: var(--line);
  border-radius: var(--rcc-radius-card, 18px);
  box-shadow: var(--rcc-shadow-sm);
}

/* Tables: RCC row language with uppercase small headers. */
.table {
  color: var(--ink);
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--line);
}

.table thead th {
  color: var(--navy);
  font-size: .78rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* Status and label pills in the RCC badge language. */
.badge,
.label {
  border-radius: 999px;
  background-color: var(--cyan-light);
  color: var(--navy-2);
  font-weight: 700;
}

.badge.bg-success,
.badge.text-bg-success {
  background-color: #effaf4 !important;
  color: #155c3d !important;
}

.badge.bg-danger,
.badge.text-bg-danger {
  background-color: #fff1f2 !important;
  color: #8b1730 !important;
}

.badge.bg-warning,
.badge.text-bg-warning {
  background-color: #fff8e8 !important;
  color: #765016 !important;
}

/* Alerts in the canonical status triads. */
.alert-success {
  background-color: #effaf4;
  border-color: #a7d6bd;
  color: #155c3d;
}

.alert-danger {
  background-color: #fff1f2;
  border-color: #efb4bf;
  color: #8b1730;
}

.alert-warning {
  background-color: #fff8e8;
  border-color: #e9cd8e;
  color: #765016;
}

/* Selection and text-muted follow the RCC muted/cyan-light tokens. */
::selection {
  background: var(--cyan-light);
  color: var(--navy);
}

/* ---- RCC application shell (overlay v9, operator 2026-11-17). ----
   The same frame as RCC Admin and Home: a white top bar with the navy RCC
   wordmark on the left and the site logo and session on the right, and a
   white left rail that lists the RCC services in registry order with Files
   current. The overlay puts the service list into SFTPGo's own rail
   (sidebaritems) and the wordmark, logo and session wording into its header;
   native file controls stay upstream-owned. */

#kt_app_header {
  background: var(--rcc-topbar-surface);
  border-bottom: 1px solid var(--rcc-border-topbar);
  box-shadow: none;
  color: var(--rcc-ink);
}

/* The header's empty left slot gives way to the wordmark. The upstream slot
   holds only whitespace, which :empty does not match (live check 2026-11-17:
   it took the left half of the bar and centred the wordmark). */
#kt_app_header_navbar > .app-navbar-item:not(:has(*)) { display: none !important; }
#kt_app_header_navbar,
#kt_app_header_navbar > .flex-center {
  flex-grow: 1;
}
#kt_app_header_navbar > .flex-center { justify-content: flex-end; gap: .75rem; }

.rcc-sftpgo-brand {
  display: flex;
  align-items: center;
  margin-right: auto;
  text-decoration: none;
  white-space: nowrap;
}

.rcc-sftpgo-brand-copy {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.rcc-sftpgo-brand-copy strong {
  color: var(--rcc-navy);
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: .02em;
}

.rcc-sftpgo-brand-copy span {
  padding-left: .7rem;
  border-left: 1px solid var(--rcc-home-divider);
  color: var(--rcc-ink);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* The hospital logo is dark artwork; it sits on a white tile, as in Admin.
   The generic branding-image rule above (max-width: 100%, height: auto) made
   the session group size to the logo alone, so "You are logged in as" ran
   off the right edge (live check 2026-11-17); this logo keeps its own size. */
#app_root img.rcc-sftpgo-logo,
.rcc-sftpgo-logo {
  display: block;
  flex-shrink: 0;
  width: auto;
  max-width: none;
  height: 38px !important;
  margin-right: .75rem;
  padding: .18rem .3rem;
  border-radius: 2px;
  background: #fff;
}

/* SFTPGo's pinned account dropdown remains the native owner of Sign out.
   The overlay replaces only its icon trigger with the plain session wording
   used by RCC Admin, white on the top bar. */
.rcc-sftpgo-session {
  flex-shrink: 0;
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--rcc-radius-button);
  color: var(--rcc-muted);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: .86rem;
  padding: .45rem .6rem;
  white-space: nowrap;
}

.rcc-sftpgo-session strong {
  color: var(--rcc-ink);
  margin-left: .25rem;
}

.rcc-sftpgo-session:hover,
.rcc-sftpgo-session:focus-visible {
  background: var(--rcc-cyan-light);
  color: var(--rcc-navy);
}

.rcc-sftpgo-session:focus-visible {
  outline: 3px solid var(--rcc-navy);
  outline-offset: 2px;
}

/* The left rail: RCC Admin's sidebar language on SFTPGo's native rail. */
#kt_app_sidebar {
  background: var(--rcc-paper);
  border-right: 1px solid var(--rcc-line);
  box-shadow: none;
}

/* The rail's own logo/name header repeats the top bar. */
#kt_app_sidebar_header { display: none !important; }
#kt_app_sidebar_navs_wrappers { margin: 1rem .75rem !important; }

.rcc-sftpgo-rail {
  display: grid;
  gap: .1rem;
  margin-bottom: .4rem;
  font-family: var(--rcc-font-family);
}

.rcc-sftpgo-rail a,
#kt_app_sidebar .menu-item .menu-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .58rem .65rem;
  border-radius: var(--rcc-radius-button);
  color: var(--rcc-ink);
  font-size: .86rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}

#kt_app_sidebar .menu-item .menu-title { color: inherit !important; font-size: inherit; font-weight: inherit; }
#kt_app_sidebar .menu-item .menu-icon { display: none; }

.rcc-sftpgo-rail a:hover,
#kt_app_sidebar .menu-item .menu-link:hover {
  background: var(--rcc-surface-sunken);
  color: var(--rcc-navy);
}

.rcc-sftpgo-rail a.current,
#kt_app_sidebar .menu-item .menu-link.active {
  background: var(--rcc-cyan-light);
  color: var(--rcc-navy);
  box-shadow: inset 3px 0 0 var(--rcc-navy);
  font-weight: 650;
}

.rcc-sftpgo-handoff { margin: 1.25rem 0 .75rem; color: var(--rcc-ink); }

/* The signed-in 403 page is the My RCC hand-off (for example a bookmarked
   2FA page): show it as account settings, not as SFTPGo's "Forbidden"
   warning (operator review walk 2026-11-17). */
#app_root .card:has(.rcc-sftpgo-handoff) .card-body > .notice { display: none !important; }
/* SFTPGo's .section-title pins its size with !important (live check
   2026-11-17 showed "ForbiddenAccount settings"). */
#app_root .card:has(.rcc-sftpgo-handoff) .card-title { font-size: 0 !important; }
#app_root .card:has(.rcc-sftpgo-handoff) .card-title::after {
  content: "Account settings";
  font-size: 1.15rem;
}
#app_root .card:has(.rcc-sftpgo-handoff) .rcc-sftpgo-handoff { margin-top: 0; }

/* Under the rail, as RCC Admin's sidebar note. */
.rcc-sftpgo-rail-note {
  margin: 1.1rem .1rem 0;
  padding: .85rem;
  border: 1px solid var(--rcc-line);
  border-radius: var(--rcc-radius-card);
  background: var(--rcc-surface-sunken);
  font-family: var(--rcc-font-family);
}
.rcc-sftpgo-rail-note strong,
.rcc-sftpgo-rail-note span { display: block; }
.rcc-sftpgo-rail-note strong { color: var(--rcc-ink); font-size: .82rem; }
.rcc-sftpgo-rail-note span { margin-top: .35rem; color: var(--rcc-muted); font-size: .76rem; line-height: 1.48; }

/* The web UI hides plumbing: the footer holds only the SFTPGo build string. */
#kt_app_footer { display: none !important; }

/* Desktop (SFTPGo's lg breakpoint): the top bar spans the full width above a
   250px rail, as in RCC Admin. Only the reviewed KeenThemes layout variables
   and positions are overridden; SFTPGo's own templates stay unforked. Below
   992px the rail stays SFTPGo's native drawer behind the menu button. */
@media (min-width: 992px) {
  html body[data-kt-app-sidebar-fixed="true"] {
    --bs-app-sidebar-width: 250px !important;
    --bs-app-sidebar-width-actual: 250px !important;
    --bs-app-header-height: 64px !important;
    --bs-app-header-height-actual: 64px !important;
  }

  html body[data-kt-app-header-fixed="true"] #kt_app_header {
    left: 0 !important;
  }

  html body[data-kt-app-sidebar-fixed="true"] #kt_app_sidebar {
    top: var(--bs-app-header-height) !important;
    z-index: 99;
  }

  #kt_app_header .app-container {
    max-width: none;
    padding-inline: 1.25rem !important;
  }

  #kt_app_content_container {
    max-width: 1220px;
    margin-inline: auto;
    padding: 1rem 1.6rem 4rem !important;
  }
}

@media (max-width: 991.98px) {
  /* The native mobile header already shows the hospital logo. */
  .rcc-sftpgo-logo,
  .rcc-sftpgo-brand-copy span {
    display: none;
  }

  #kt_app_sidebar_mobile_toggle i { color: var(--rcc-ink) !important; }

  .rcc-sftpgo-session {
    white-space: normal;
  }
}

/* ---- Same measure as RCC Admin (operator 2026-11-17: "both in dark mode
   (nice) but the look is quite different"). SFTPGo pins the root font size
   to 13px (12px below 992px), so every rem above came out about a fifth
   smaller than on RCC Admin, which uses 16px. The shell's own parts take
   RCC Admin's measured sizes in px instead; native file controls keep
   SFTPGo's size. Values measured on live RCC Admin at 1600px. ---- */
@media (min-width: 992px) {
  html body[data-kt-app-sidebar-fixed="true"] {
    --bs-app-header-height: 77px !important;
    --bs-app-header-height-actual: 77px !important;
  }

  /* The wordmark sits above the rail at every width (the RCC shell spans
     the window; RCC Admin's 1760px cap is dropped in its next image). */
  #kt_app_header .app-container {
    max-width: none;
    padding: 14px 30px !important;
  }

  #kt_app_sidebar_navs_wrappers { margin: 16px 12px !important; }
}

.rcc-sftpgo-brand-copy { gap: 11px; }
.rcc-sftpgo-brand-copy strong { font-size: 32px; font-weight: 700; letter-spacing: 0; line-height: 1; }
.rcc-sftpgo-brand-copy span { padding-left: 11px; font-size: 11.5px; font-weight: 400; letter-spacing: .02em; text-transform: none; line-height: 1.2; }
#app_root img.rcc-sftpgo-logo,
.rcc-sftpgo-logo { height: 48px !important; margin-right: 20px; padding: 3px 5px; }
.rcc-sftpgo-session { font-size: 12.8px; padding: 6px 8px; }

.rcc-sftpgo-rail { gap: 2px; }
.rcc-sftpgo-rail a,
#kt_app_sidebar .menu-item .menu-link { padding: 9px 10px; font-size: 13.75px; line-height: 1.25; }
.rcc-sftpgo-rail-note strong { font-size: 13px; }
.rcc-sftpgo-rail-note span { font-size: 12px; }
#app_root .card:has(.rcc-sftpgo-handoff) .card-title::after { font-size: 18px; }

@media (max-width: 991.98px) {
  .rcc-sftpgo-brand-copy strong { font-size: 24px; }
}
