/* ElectroNous application shell
 * Canonical styles for authenticated headers and the Facility login layout.
 * Product workspaces and sidebars intentionally live outside this stylesheet.
 */

:root {
  --en-shell-page: #fafafa;
  --en-shell-surface: #ffffff;
  --en-shell-surface-muted: #f5f5f5;
  --en-shell-ink: #212121;
  --en-shell-muted: #737373;
  --en-shell-line: #e5e5e5;
  --en-shell-line-strong: #d4d4d4;
  --en-shell-button: #3a3a3a;
  --en-shell-button-hover: #262626;
  --en-shell-brand: #f7a917;
  --en-shell-danger: #b42318;
  --en-shell-radius: 6px;
  --en-app-header-height: 48px;
  --en-auth-header-height: 58px;
}

.dark {
  --en-shell-page: #262626;
  --en-shell-surface: #3a3a3a;
  --en-shell-surface-muted: #454545;
  --en-shell-ink: #fafafa;
  --en-shell-muted: #d4d4d4;
  --en-shell-line: #525252;
  --en-shell-line-strong: #737373;
  --en-shell-button: #f5f5f5;
  --en-shell-button-hover: #ffffff;
}

.en-app-header,
.en-auth-header,
.en-app-header *,
.en-auth-header *,
.en-login-shell,
.en-login-shell * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.en-app-header,
.en-auth-header {
  display: flex;
  position: relative;
  z-index: 60;
  width: 100%;
  flex: none;
  border-bottom: 1px solid var(--en-shell-line);
  background: rgba(255, 255, 255, .86);
  color: var(--en-shell-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  backdrop-filter: blur(12px);
}

.en-app-header { height: var(--en-app-header-height); }

.en-auth-header {
  position: sticky;
  top: 0;
  height: var(--en-auth-header-height);
  z-index: 60;
}

.dark .en-app-header,
.dark .en-auth-header {
  border-color: #525252 !important;
  background: rgba(58, 58, 58, .88) !important;
  color: #fafafa;
}

.en-header-inner {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 0 12px;
  display: grid;
  grid-template-columns: minmax(270px, 1fr) auto minmax(270px, 1fr);
  align-items: center;
  gap: 16px;
}

.en-auth-header .en-header-inner {
  width: min(1152px, calc(100% - 32px));
  padding: 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.en-auth-header .en-header-actions { gap: 4px; }

.en-header-left,
.en-header-center,
.en-header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
}

.en-header-left {
  justify-self: start;
  gap: 8px;
}

.en-sidebar-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.en-sidebar-button svg {
  width: 20px !important;
  height: 20px !important;
}

.en-app-header .en-header-left .en-product-menu {
  transform: translateY(3.5px);
}

.en-header-center {
  justify-self: center;
  max-width: 100%;
}

.en-header-actions {
  justify-self: end;
  gap: 3px;
}

.en-header-actions form { margin: 0; }

.en-header-slot {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.en-view-nav {
  min-width: 0;
  margin: 0;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #e2e2e2;
  border-radius: 7px;
  background: #f1f1f1;
}

.en-view-nav > a,
.en-view-nav > button {
  min-width: 74px;
  height: 30px;
  margin: 0;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #606060;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.en-view-nav > a:hover,
.en-view-nav > button:hover,
.en-view-nav > .is-active,
.en-view-nav > .active {
  background: #ffffff;
  color: #202020;
  text-decoration: none;
}

.en-view-nav > .is-active,
.en-view-nav > .active { box-shadow: 0 1px 2px rgba(32, 32, 32, .08); }

.en-view-nav-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.dark .en-view-nav {
  border-color: #3f3f46;
  background: #27272a;
}

.dark .en-view-nav > a,
.dark .en-view-nav > button { color: #a1a1aa; }

.dark .en-view-nav > a:hover,
.dark .en-view-nav > button:hover,
.dark .en-view-nav > .is-active,
.dark .en-view-nav > .active {
  background: #3f3f46;
  color: #fafafa;
}

.en-product-menu,
.en-header-menu {
  position: relative;
  min-width: 0;
  margin: 0;
  color: var(--en-shell-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.en-header-menu { height: 36px; }
.en-product-menu { height: auto; flex: none; }

.en-product-menu > summary,
.en-header-menu > summary { list-style: none; }

.en-product-menu > summary::-webkit-details-marker,
.en-header-menu > summary::-webkit-details-marker { display: none; }

.en-product-trigger,
.en-product-trigger:hover,
.en-product-trigger:active {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.en-product-trigger:focus-visible,
.en-icon-button:focus-visible,
.en-account-trigger:focus-visible {
  outline: 2px solid rgba(247, 169, 23, .55);
  outline-offset: 2px;
}

.en-product-trigger img {
  width: 20px;
  height: 27px;
  margin-right: 10px;
  object-fit: contain;
}

.en-product-brand {
  color: inherit;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.en-product-name {
  max-width: 190px;
  margin-left: 9px;
  padding-left: 9px;
  overflow: hidden;
  border-left: 1px solid rgba(33, 33, 33, .12);
  color: var(--en-shell-muted);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .en-product-name { border-left-color: rgba(255, 255, 255, .16); }

.en-product-popover,
.en-header-popover,
.en-account-popover {
  position: absolute;
  z-index: 100;
  min-width: 0;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--en-shell-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 38px rgba(32, 32, 32, .14);
  color: #212121;
  text-align: left;
  backdrop-filter: blur(12px);
}

.en-product-popover {
  top: calc(100% + 15px);
  left: 0;
  width: 225px;
}

.en-header-popover,
.en-account-popover {
  top: calc(100% + 4px);
  right: 0;
  width: 208px;
}

.dark .en-product-popover,
.dark .en-header-popover,
.dark .en-account-popover {
  border-color: #525252;
  background: rgba(39, 39, 42, .98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .35);
  color: #fafafa;
}

.en-popover-label {
  display: block;
  padding: 6px 9px 5px;
  color: var(--en-shell-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.en-product-popover a,
.en-popover-current,
.en-header-popover a,
.en-header-popover button,
.en-account-popover a,
.en-account-popover button {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
}

.en-product-popover a:hover,
.en-header-popover a:hover,
.en-header-popover button:hover,
.en-account-popover a:hover,
.en-account-popover button:hover {
  background: #f1f1f1;
  text-decoration: none;
}

.dark .en-product-popover a:hover,
.dark .en-header-popover a:hover,
.dark .en-header-popover button:hover,
.dark .en-account-popover a:hover,
.dark .en-account-popover button:hover { background: #3f3f46; }

.en-product-popover svg,
.en-header-popover svg,
.en-account-popover svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.en-popover-current {
  color: var(--en-shell-muted);
  background: #f1f1f1;
}

.dark .en-popover-current { background: #3f3f46; }

.en-current-mark {
  margin-left: auto;
  color: #14805e;
  font-size: 10px;
  font-weight: 700;
}

.en-icon-button,
.en-account-trigger {
  height: 36px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6f6f6f;
  cursor: pointer;
  font: inherit;
  transition: color .15s ease, background-color .15s ease;
}

.en-icon-button { width: 36px; flex: none; }
.en-account-trigger { gap: 8px; max-width: 210px; padding: 0 8px; }

.en-icon-button:hover,
.en-account-trigger:hover,
.en-header-menu[open] > .en-icon-button,
.en-header-menu[open] > .en-account-trigger {
  background: #f1f1f1;
  color: #202020;
}

.dark .en-icon-button,
.dark .en-account-trigger { color: #d4d4d4; }

.dark .en-icon-button:hover,
.dark .en-account-trigger:hover,
.dark .en-header-menu[open] > .en-icon-button,
.dark .en-header-menu[open] > .en-account-trigger {
  background: #3f3f46;
  color: #fafafa;
}

.en-icon-button > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.en-auth-header .en-icon-button > svg {
  width: 24px;
  height: 24px;
}

.en-theme-toggle .en-sun-icon { display: none; }
.en-theme-toggle .en-moon-icon { display: block; }
.dark .en-theme-toggle .en-sun-icon { display: block; }
.dark .en-theme-toggle .en-moon-icon { display: none; }

.en-account-avatar,
.en-account-initial {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
}

.en-account-avatar { display: block; object-fit: cover; }

.en-account-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e5e5;
  color: #3a3a3a;
  font-size: 12px;
  font-weight: 700;
}

.dark .en-account-initial { background: #525252; color: #fafafa; }

.en-account-name {
  min-width: 0;
  max-width: 128px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.en-account-chevron {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.en-account-meta {
  margin: -7px -7px 1px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--en-shell-line);
}

.en-account-meta strong,
.en-account-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.en-account-meta strong { font-size: 13px; }
.en-account-meta span { margin-top: 3px; color: var(--en-shell-muted); font-size: 11px; }

.en-auth-page {
  min-height: 100%;
  margin: 0;
  color-scheme: light;
  background: var(--en-shell-page);
  color: var(--en-shell-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.dark .en-auth-page { color-scheme: dark; }

.en-login-shell {
  min-height: calc(100vh - var(--en-auth-header-height));
  min-height: calc(100dvh - var(--en-auth-header-height));
  padding: 32px 24px;
  display: grid;
  place-items: center;
  background: var(--en-shell-page);
  color: var(--en-shell-ink);
}

.en-login-panel {
  width: min(390px, 100%);
  padding: 30px;
  border: 1px solid var(--en-shell-line);
  border-radius: var(--en-shell-radius);
  background: var(--en-shell-surface);
  box-shadow: 0 16px 42px rgba(33, 33, 33, .07);
}

.dark .en-login-panel { box-shadow: 0 16px 42px rgba(0, 0, 0, .18); }

.en-login-heading { margin-bottom: 24px; }

.en-login-heading img {
  width: 19px;
  height: 25px;
  margin-right: 8px;
  object-fit: contain;
  vertical-align: middle;
}

.en-login-heading > span {
  color: var(--en-shell-muted);
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}

.en-login-heading h1 {
  margin: 18px 0 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.en-login-form { display: grid; gap: 15px; }

.en-login-form label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.en-login-form label > span {
  color: var(--en-shell-muted);
  font-size: 12px;
  font-weight: 600;
}

.en-login-form input:not([type="hidden"]) {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--en-shell-line-strong);
  border-radius: var(--en-shell-radius);
  background: var(--en-shell-surface);
  color: var(--en-shell-ink);
  font: inherit;
  font-size: 14px;
}

.en-login-form input:focus {
  outline: 2px solid rgba(247, 169, 23, .24);
  border-color: var(--en-shell-brand);
}

.en-primary-button,
.en-secondary-button {
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--en-shell-radius);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.en-primary-button {
  width: 100%;
  margin-top: 4px;
  border: 0;
  background: var(--en-shell-button);
  color: #ffffff;
}

.en-primary-button:hover { background: var(--en-shell-button-hover); }
.dark .en-primary-button { color: #212121; }

.en-secondary-button {
  border: 1px solid var(--en-shell-line);
  background: var(--en-shell-surface-muted);
  color: var(--en-shell-ink);
}

.en-secondary-button:hover { background: var(--en-shell-line); }

.en-alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #f2b8b5;
  border-radius: var(--en-shell-radius);
  background: #fff1f0;
  color: #8e1b13;
  font-size: 13px;
}

.en-alert ul,
.en-field-error ul { margin: 0; padding-left: 18px; }

.en-field-error { margin: 0; color: var(--en-shell-danger); font-size: 12px; }

.dark .en-alert {
  border-color: #7d4845;
  background: #4b3030;
  color: #ffd0cc;
}

/* Existing account-management templates use the original Facility class names. */
.en-auth-page .login-shell {
  min-height: calc(100vh - var(--en-auth-header-height));
  min-height: calc(100dvh - var(--en-auth-header-height));
  padding: 32px 24px;
  display: grid;
  place-items: center;
}

.en-auth-page .login-panel {
  width: min(390px, 100%);
  padding: 30px;
  border: 1px solid var(--en-shell-line);
  border-radius: var(--en-shell-radius);
  background: var(--en-shell-surface);
  box-shadow: 0 16px 42px rgba(33, 33, 33, .07);
}

.en-auth-page .login-heading { margin-bottom: 24px; }
.en-auth-page .login-heading img { width: 19px; height: 25px; margin-right: 8px; object-fit: contain; vertical-align: middle; }
.en-auth-page .login-heading > span { color: var(--en-shell-muted); font-size: 13px; font-weight: 600; vertical-align: middle; }
.en-auth-page .login-heading h1 { margin: 18px 0 0; font-size: 26px; font-weight: 700; line-height: 1.2; }
.en-auth-page .stack { display: grid; gap: 15px; }
.en-auth-page .stack label { min-width: 0; display: grid; gap: 6px; }
.en-auth-page .stack label > span { color: var(--en-shell-muted); font-size: 12px; font-weight: 600; }
.en-auth-page .stack input:not([type="hidden"]) { width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--en-shell-line-strong); border-radius: var(--en-shell-radius); background: var(--en-shell-surface); color: var(--en-shell-ink); font: inherit; font-size: 14px; }
.en-auth-page .stack input:focus { outline: 2px solid rgba(247, 169, 23, .24); border-color: var(--en-shell-brand); }
.en-auth-page .primary-button,
.en-auth-page .secondary-button { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--en-shell-radius); cursor: pointer; font: inherit; font-size: 13px; font-weight: 650; text-decoration: none; }
.en-auth-page .primary-button { width: 100%; margin-top: 4px; border: 0; background: var(--en-shell-button); color: #fff; }
.en-auth-page .primary-button:hover { background: var(--en-shell-button-hover); }
.dark .en-auth-page .primary-button { color: #212121; }
.en-auth-page .secondary-button { border: 1px solid var(--en-shell-line); background: var(--en-shell-surface-muted); color: var(--en-shell-ink); }
.en-auth-page .secondary-button:hover { background: var(--en-shell-line); }
.en-auth-page .alert { margin-bottom: 16px; padding: 10px 12px; border: 1px solid #f2b8b5; border-radius: var(--en-shell-radius); background: #fff1f0; color: #8e1b13; font-size: 13px; }
.dark .en-auth-page .alert { border-color: #7d4845; background: #4b3030; color: #ffd0cc; }
.en-auth-page .field-error { margin: 0; color: var(--en-shell-danger); font-size: 12px; }

@media (max-width: 920px) {
  .en-product-brand { display: none; }
  .en-product-name {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    color: inherit;
    font-size: 14px;
    font-weight: 650;
  }
  .en-product-trigger img { width: 17px; height: 24px; margin-right: 7px; }
}

@media (max-width: 860px) {
  .en-header-inner {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
  }
}

@media (max-width: 680px) {
  .en-auth-header .en-header-inner { width: min(100% - 24px, 1152px); }
  .en-view-nav > a,
  .en-view-nav > button { min-width: 0; width: 34px; padding: 0; }
  .en-view-nav > a > span,
  .en-view-nav > button > span { display: none; }
  .en-login-shell { padding: 24px 12px; }
  .en-login-panel { padding: 25px 22px; }
  .en-auth-page .login-shell { padding: 24px 12px; }
  .en-auth-page .login-panel { padding: 25px 22px; }
}

@media (max-width: 640px) {
  .en-header-action-language { display: none; }
  .en-account-name { display: none; }
  .en-account-trigger { gap: 5px; padding: 0 5px; }
}

@media (max-width: 520px) {
  .en-product-name { display: none; }
  .en-product-trigger img { margin-right: 0; }
  .en-header-inner { padding-inline: 8px; }
  .en-header-center { overflow: hidden; }
}
