:root {
  --newfera-primary: #f36b22;
  --newfera-primary-rgb: 243, 107, 34;
  --newfera-primary-strong: #c64f10;
  --newfera-primary-soft: #fff4ed;
  --newfera-on-primary: #15191e;
  --newfera-accent: #181b20;
  --newfera-accent-rgb: 24, 27, 32;
  --newfera-accent-strong: #181b20;
  --newfera-accent-soft: #f1f2f3;
  --newfera-sidebar-surface: #fffaf7;
  --newfera-panel-start: #9d4c21;
  --newfera-panel-end: #17191d;
  --newfera-finance: #0f9f82;
  --newfera-selling: #e86d25;
  --newfera-stock: #3478d4;
  --newfera-projects: #7d5ac7;
  --newfera-buying: #c88a13;
  --newfera-manufacturing: #5368c7;
  --newfera-hr: #cc4e72;
  --newfera-support: #178cab;
  --newfera-admin: #64748b;
  --newfera-neutral: #65758b;
}

html[data-newfera-branded="true"] body {
  color: #263142;
}

html[data-newfera-branded="true"] .btn-primary,
html[data-newfera-branded="true"] .page-head .primary-action,
html[data-newfera-branded="true"] .standard-actions .btn-primary {
  background: var(--newfera-primary-strong) !important;
  border-color: var(--newfera-primary-strong) !important;
  box-shadow: 0 6px 16px rgba(var(--newfera-primary-rgb), .2);
}

html[data-newfera-branded="true"] .btn-primary:hover,
html[data-newfera-branded="true"] .btn-primary:focus,
html[data-newfera-branded="true"] .page-head .primary-action:hover,
html[data-newfera-branded="true"] .standard-actions .btn-primary:hover {
  background: var(--newfera-accent-strong) !important;
  border-color: var(--newfera-accent-strong) !important;
}

html[data-newfera-branded="true"] .indicator-pill.orange,
html[data-newfera-branded="true"] .indicator.orange::before {
  --indicator-color: var(--newfera-primary-strong);
}

/* One restrained identity block; Frappe's native home link remains the navigation target. */
html[data-newfera-branded="true"] header.navbar-container,
html[data-newfera-branded="true"] header.navbar {
  min-height: 58px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 5px 22px rgba(15, 23, 42, .055);
  backdrop-filter: blur(14px);
}

.newfera-navbar-brand {
  display: inline-flex !important;
  align-items: center;
  flex: 0 1 auto;
  gap: 10px;
  min-width: 0;
  margin: 0 18px 0 2px;
  padding: 5px 0;
  text-decoration: none !important;
}

.newfera-navbar-logo {
  display: block;
  width: auto;
  max-width: 118px;
  height: 32px;
  object-fit: contain;
}

.newfera-navbar-copy {
  display: grid;
  min-width: 0;
  line-height: 1.08;
}

.newfera-navbar-copy strong {
  max-width: 230px;
  overflow: hidden;
  color: #172033;
  font-size: 12px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newfera-navbar-copy small {
  margin-top: 3px;
  color: #8490a1;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.newfera-hidden-brand-duplicate { display: none !important; }

html[data-newfera-branded="true"] header.navbar-container .desktop-search-wrapper,
html[data-newfera-branded="true"] header.navbar .desktop-search-wrapper {
  margin-left: auto;
}

html[data-newfera-branded="true"] .desktop-search-wrapper:focus-within {
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(var(--newfera-primary-rgb), .14);
}

/* Login shell is injected around Frappe's own form; authentication behavior stays native. */
html[data-newfera-branded="true"] #page-login .page-content-wrapper,
html[data-newfera-branded="true"] #page-login main.container,
html[data-newfera-branded="true"] #page-login .page_content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

html[data-newfera-branded="true"] #page-login {
  min-height: 100vh;
  background: #f4f6f9;
}

.newfera-login-shell {
  display: grid;
  grid-template-columns: minmax(360px, 46%) minmax(420px, 54%);
  width: min(1180px, calc(100vw - 64px));
  min-height: 660px;
  margin: 52px auto;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .13);
}

.newfera-login-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 52px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 18%, rgba(255, 255, 255, .14) 0 90px, transparent 91px),
    linear-gradient(145deg, var(--newfera-panel-start), var(--newfera-panel-end));
  background-size: 28px 28px, auto, auto;
}

.newfera-login-brand-panel::after {
  position: absolute;
  right: -130px;
  bottom: -150px;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 50%;
  box-shadow: 0 0 0 58px rgba(255, 255, 255, .035), 0 0 0 116px rgba(255, 255, 255, .025);
  content: "";
}

.newfera-login-identity {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.newfera-login-logo {
  width: auto;
  max-width: 156px;
  height: 52px;
  padding: 6px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}

.newfera-login-brand-copy {
  display: grid;
  line-height: 1.1;
}

.newfera-login-brand-copy strong {
  max-width: 280px;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newfera-login-brand-copy small {
  margin-top: 5px;
  color: rgba(255, 255, 255, .68);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.newfera-login-message {
  position: relative;
  z-index: 1;
  max-width: 470px;
  margin: auto 0 22px;
}

.newfera-login-eyebrow {
  display: block;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, .67);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: .2em;
}

.newfera-login-message h1 {
  margin: 0 0 17px;
  color: #fff;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 690;
  line-height: 1.03;
  letter-spacing: -.045em;
}

.newfera-login-message p {
  max-width: 400px;
  margin: 0 0 34px;
  color: rgba(255, 255, 255, .78);
  font-size: 16px;
  line-height: 1.65;
}

.newfera-login-message ul {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.newfera-login-message li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(255, 255, 255, .88);
  font-size: 13px;
}

.newfera-login-message li::before {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  content: "✓";
  font-size: 11px;
  font-weight: 800;
}

.newfera-login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 7vw, 96px);
  background: #fff;
}

.newfera-login-form-panel .page-card-head {
  width: 100%;
  max-width: 410px;
  margin: 0 auto 28px;
  text-align: left;
}

.newfera-login-form-panel .page-card-head > img { display: none !important; }

.newfera-login-form-panel .page-card-head h4 {
  margin: 0;
  color: #182132;
  font-size: 31px;
  font-weight: 700;
  letter-spacing: -.035em;
}

.newfera-login-subtitle {
  margin: 10px 0 0;
  color: #718096;
  font-size: 14px;
}

.newfera-login-form-panel .page-card {
  width: 100%;
  max-width: 410px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.newfera-login-form-panel .form-control {
  min-height: 48px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fbfcfe;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.newfera-login-form-panel .form-control:focus {
  border-color: var(--newfera-primary-strong);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(var(--newfera-primary-rgb), .11);
}

.newfera-login-form-panel .btn-login {
  min-height: 48px;
  margin-top: 6px;
  border-radius: 10px;
  font-weight: 680;
}

.newfera-login-form-panel .forgot-password-message { margin-top: 18px; }
.newfera-login-form-panel .forgot-password-message a { color: var(--newfera-primary-strong); }

/* Tenant color foundation shared by Workspace, list and module views. */
html[data-newfera-branded="true"] .body-sidebar,
html[data-newfera-branded="true"] .desk-sidebar,
html[data-newfera-branded="true"] .layout-side-section {
  background: linear-gradient(180deg, var(--newfera-sidebar-surface), #fff 56%);
}

html[data-newfera-branded="true"] .standard-sidebar-item {
  margin: 2px 7px;
  border-left: 3px solid transparent;
  border-radius: 8px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

html[data-newfera-branded="true"] .standard-sidebar-item:hover {
  color: var(--newfera-primary-strong);
  background: rgba(var(--newfera-primary-rgb), .075);
  transform: translateX(1px);
}

html[data-newfera-branded="true"] .standard-sidebar-item.selected,
html[data-newfera-branded="true"] .desk-sidebar .standard-sidebar-item.selected,
html[data-newfera-branded="true"] .layout-side-section .standard-sidebar-item.selected {
  color: var(--newfera-primary-strong);
  border-left-color: var(--newfera-primary-strong);
  background: rgba(var(--newfera-primary-rgb), .11);
  font-weight: 650;
}

html[data-newfera-branded="true"] .standard-sidebar-item:focus-visible {
  outline: 2px solid var(--newfera-accent-strong);
  outline-offset: 1px;
}

html[data-newfera-branded="true"] .sidebar-item-container .badge,
html[data-newfera-branded="true"] .body-sidebar .indicator-pill {
  color: var(--newfera-accent-strong);
  border-color: rgba(var(--newfera-accent-rgb), .18);
  background: var(--newfera-accent-soft);
}

html[data-newfera-branded="true"] .search-bar input:focus,
html[data-newfera-branded="true"] .input-with-feedback:focus {
  border-color: var(--newfera-primary-strong);
  box-shadow: 0 0 0 3px rgba(var(--newfera-primary-rgb), .1);
}

.desktop-icon[data-newfera-tone] .icon-container {
  border: 1px solid color-mix(in srgb, var(--newfera-tone-color) 17%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--newfera-tone-color) 16%, #fff);
  box-shadow: 0 7px 22px color-mix(in srgb, var(--newfera-tone-color) 11%, transparent);
  transition: transform .18s ease, box-shadow .18s ease;
}

.desktop-icon[data-newfera-tone] .icon-container img {
  filter: grayscale(.82) opacity(.74);
  mix-blend-mode: multiply;
}

.desktop-icon[data-newfera-tone]:hover .icon-container,
.desktop-icon[data-newfera-tone]:focus .icon-container {
  transform: translateY(-2px);
  box-shadow: 0 11px 27px color-mix(in srgb, var(--newfera-tone-color) 17%, transparent);
}

.sidebar-item-container[data-newfera-tone] .sidebar-item-icon { color: var(--newfera-tone-color); }
.sidebar-item-container[data-newfera-tone] .sidebar-item-icon svg { color: inherit; }

[data-newfera-tone="finance"] { --newfera-tone-color: var(--newfera-finance); }
[data-newfera-tone="selling"] { --newfera-tone-color: var(--newfera-selling); }
[data-newfera-tone="stock"] { --newfera-tone-color: var(--newfera-stock); }
[data-newfera-tone="projects"] { --newfera-tone-color: var(--newfera-projects); }
[data-newfera-tone="buying"] { --newfera-tone-color: var(--newfera-buying); }
[data-newfera-tone="manufacturing"] { --newfera-tone-color: var(--newfera-manufacturing); }
[data-newfera-tone="hr"] { --newfera-tone-color: var(--newfera-hr); }
[data-newfera-tone="support"] { --newfera-tone-color: var(--newfera-support); }
[data-newfera-tone="admin"] { --newfera-tone-color: var(--newfera-admin); }
[data-newfera-tone="neutral"] { --newfera-tone-color: var(--newfera-neutral); }

.newfera-fallback-brand {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
}

.newfera-fallback-brand strong { color: var(--newfera-accent-strong); font-size: .95rem; }
.newfera-fallback-brand small { color: #6b7280; font-size: .58rem; letter-spacing: .13em; text-transform: uppercase; }
html[data-newfera-branded="true"] .splash img { max-width: 240px; max-height: 84px; object-fit: contain; }

@media (max-width: 900px) {
  .newfera-login-shell {
    grid-template-columns: 1fr;
    width: min(620px, calc(100vw - 32px));
    margin: 24px auto;
  }
  .newfera-login-brand-panel { min-height: 340px; padding: 36px; }
  .newfera-login-message { margin: 60px 0 0; }
  .newfera-login-message h1 { font-size: 38px; }
  .newfera-login-message p { margin-bottom: 22px; }
  .newfera-login-form-panel { padding: 52px 36px 60px; }
  .newfera-navbar-copy strong { max-width: 125px; }
}

@media (max-width: 620px) {
  .newfera-login-shell { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .newfera-login-brand-panel { min-height: 290px; padding: 28px 24px; }
  .newfera-login-logo { max-width: 122px; height: 44px; }
  .newfera-login-brand-copy strong { max-width: 180px; }
  .newfera-login-message { margin-top: 44px; }
  .newfera-login-message h1 { font-size: 32px; }
  .newfera-login-message ul { display: none; }
  .newfera-login-form-panel { padding: 42px 24px 52px; }
  .newfera-login-form-panel .page-card-head h4 { font-size: 27px; }
  .newfera-navbar-copy small { display: none; }
  .newfera-navbar-logo { max-width: 88px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .desktop-icon[data-newfera-tone] .icon-container,
  html[data-newfera-branded="true"] .standard-sidebar-item { transition: none; }
}
