/* Grupo SCE ERP theme - SCE brand system (2026) */
:root {
  --sce-red: #e30613;
  --sce-red-dark: #b8050f;
  --sce-gray: #5a5a5a;
  --sce-graphite: #1e1e1e;
  --sce-soft-black: #2b2b2b;
  --sce-mid-gray: #b7b7b7;
  --sce-soft-gray: #e8e8e8;
  --sce-light-gray: #f3f3f3;
  --sce-white: #ffffff;
  --sce-font: Montserrat, Arial, Helvetica, sans-serif;
  --sce-shadow: 0 8px 24px rgba(30, 30, 30, 0.06);
}

[data-theme="light"] {
  --primary: var(--sce-red);
  --primary-color: var(--sce-red);
  --bg-color: var(--sce-light-gray);
  --fg-color: var(--sce-white);
  --text-color: var(--sce-soft-black);
  --heading-color: var(--sce-graphite);
  --border-color: var(--sce-soft-gray);
  --control-bg: #f8f8f8;
  --subtle-fg: var(--sce-light-gray);
  --disabled-text-color: var(--sce-mid-gray);
}

[data-theme="dark"] {
  --primary: #d94a42;
  --primary-color: #d94a42;
  --bg-color: #161616;
  --fg-color: var(--sce-graphite);
  --text-color: #f3f3f3;
  --heading-color: var(--sce-white);
  --border-color: #3b3b3b;
  --control-bg: #292929;
  --subtle-fg: #252525;
}

body,
button,
input,
select,
textarea,
.frappe-control,
.form-control {
  font-family: var(--sce-font);
}

body {
  color: var(--text-color);
  background: var(--bg-color);
}

h1, h2, h3, h4, h5, h6,
.page-title,
.widget-title,
.modal-title,
.form-section .section-head {
  color: var(--heading-color);
  font-family: var(--sce-font);
  font-weight: 700;
  letter-spacing: -0.015em;
}

a,
.text-primary,
.link-primary {
  color: var(--sce-red);
}

a:hover,
a:focus-visible {
  color: var(--sce-red-dark);
}

/* Graphite navigation with one controlled red signature line. */
.navbar,
.desk-navbar {
  background: var(--sce-graphite) !important;
  border-bottom: 3px solid var(--sce-red) !important;
  box-shadow: 0 2px 10px rgba(30, 30, 30, 0.14);
}

.navbar .nav-link,
.navbar .navbar-brand,
.navbar .dropdown-toggle,
.navbar .search-bar,
.navbar .search-bar svg,
.navbar .es-icon,
.desk-navbar .nav-link {
  color: var(--sce-white) !important;
}

.navbar .navbar-brand,
.navbar-brand {
  min-width: 142px;
}

.navbar img.app-logo,
.navbar-brand img,
.page-card-head img.app-logo,
.sce-official-logo {
  width: auto !important;
  min-width: 120px;
  max-width: 176px;
  height: 38px !important;
  object-fit: contain;
}

.navbar img.app-logo,
.navbar-brand img {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  padding: 0;
  min-width: 152px;
  max-width: 190px;
  height: 46px !important;
}

/* Primary actions use the brand accent; functional status colors stay native. */
.btn-primary,
.btn.btn-primary,
.primary-action {
  background: var(--sce-red) !important;
  border-color: var(--sce-red) !important;
  color: var(--sce-white) !important;
  box-shadow: none !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn.btn-primary:hover,
.primary-action:hover {
  background: var(--sce-red-dark) !important;
  border-color: var(--sce-red-dark) !important;
}

.btn-default,
.btn-secondary {
  border-color: var(--sce-mid-gray);
  color: var(--sce-soft-black);
}

.btn-default:hover,
.btn-secondary:hover {
  border-color: var(--sce-gray);
  background: var(--sce-light-gray);
}

.form-control:focus,
.input-with-feedback:focus,
.awesomplete > input:focus,
.frappe-control input:focus,
.frappe-control textarea:focus,
.frappe-control select:focus {
  border-color: var(--sce-red) !important;
  box-shadow: 0 0 0 3px rgba(175, 35, 27, 0.13) !important;
}

.form-control::placeholder {
  color: #777;
}

.standard-sidebar-item,
.desk-sidebar .standard-sidebar-item,
.layout-side-section .sidebar-item-container {
  border-radius: 7px;
}

.standard-sidebar-item.selected,
.standard-sidebar-item.active,
.desk-sidebar .standard-sidebar-item.selected,
.layout-side-section .sidebar-item-container.selected {
  color: var(--sce-red) !important;
  background: rgba(175, 35, 27, 0.08) !important;
  box-shadow: inset 3px 0 0 var(--sce-red);
}

.standard-sidebar-item.selected svg,
.standard-sidebar-item.active svg,
.desk-sidebar .standard-sidebar-item.selected svg {
  color: var(--sce-red) !important;
  stroke: currentColor;
}

.page-head,
.layout-main-section,
.widget,
.dashboard-widget,
.frappe-card,
.form-dashboard-section,
.form-section.card-section {
  border-color: var(--border-color);
}

.widget,
.dashboard-widget,
.frappe-card,
.form-dashboard-section,
.form-section.card-section {
  border-radius: 10px;
  box-shadow: var(--sce-shadow);
}

.page-head {
  background: var(--fg-color);
}

.page-title .title-text,
.form-section .section-head {
  position: relative;
}

.page-title .title-text::after,
.form-section .section-head::after {
  content: "";
  display: block;
  width: 42px;
  height: 2px;
  margin-top: 7px;
  background: var(--sce-red);
}

.list-row:hover,
.grid-row:hover,
.report-table tbody tr:hover {
  background: rgba(175, 35, 27, 0.035) !important;
}

.list-row-head,
.grid-heading-row,
.report-table thead th {
  color: var(--sce-graphite);
  background: var(--sce-light-gray);
  font-weight: 700;
}

.nav-tabs .nav-link.active,
.nav-tabs .active > .nav-link,
.nav-tabs .active a {
  color: var(--sce-red) !important;
  border-bottom-color: var(--sce-red) !important;
}

.dropdown-menu {
  border: 1px solid var(--sce-soft-gray);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(30, 30, 30, 0.12);
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active {
  color: var(--sce-graphite);
  background: rgba(175, 35, 27, 0.08);
}

/* Login and public forms */
body[data-path="login"],
body.login-page,
.login-page {
  background: linear-gradient(115deg, var(--sce-graphite) 0 34%, var(--sce-light-gray) 34% 100%);
}

.page-card,
.login-content .page-card {
  border: 1px solid var(--sce-soft-gray);
  border-top: 4px solid var(--sce-red);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(30, 30, 30, 0.16);
}

.page-card-head {
  margin-bottom: 24px;
}

.page-card-head img.app-logo {
  min-width: 150px;
  height: auto !important;
}

*:focus-visible {
  outline: 2px solid var(--sce-red);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .navbar img.app-logo,
  .navbar-brand img {
    min-width: 112px;
    max-width: 132px;
    height: 34px !important;
  }

  body[data-path="login"],
  body.login-page,
  .login-page {
    background: var(--sce-light-gray);
  }
}

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

/* Explicit SCE light and dark variants. These classes win over Frappe defaults. */
html.sce-theme-light {
  color-scheme: light;
  --primary: var(--sce-red);
  --primary-color: var(--sce-red);
  --bg-color: var(--sce-light-gray);
  --fg-color: var(--sce-white);
  --text-color: var(--sce-soft-black);
  --heading-color: var(--sce-graphite);
  --border-color: var(--sce-soft-gray);
  --control-bg: #f8f8f8;
  --subtle-fg: var(--sce-light-gray);
}

html.sce-theme-dark {
  color-scheme: dark;
  --primary: #d94a42;
  --primary-color: #d94a42;
  --bg-color: #141414;
  --fg-color: var(--sce-graphite);
  --text-color: #f3f3f3;
  --heading-color: var(--sce-white);
  --border-color: #3c3c3c;
  --control-bg: #292929;
  --subtle-fg: #252525;
  --sce-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

html.sce-theme-dark body,
html.sce-theme-dark .page-container,
html.sce-theme-dark .layout-main,
html.sce-theme-dark .layout-main-section-wrapper {
  color: var(--text-color);
  background: var(--bg-color) !important;
}

html.sce-theme-dark .page-head,
html.sce-theme-dark .layout-main-section,
html.sce-theme-dark .desk-sidebar,
html.sce-theme-dark .layout-side-section,
html.sce-theme-dark .widget,
html.sce-theme-dark .dashboard-widget,
html.sce-theme-dark .frappe-card,
html.sce-theme-dark .form-dashboard-section,
html.sce-theme-dark .form-section.card-section,
html.sce-theme-dark .table-card,
html.sce-theme-dark .modal-content,
html.sce-theme-dark .page-card,
html.sce-theme-dark .login-content .page-card {
  color: var(--text-color);
  background: var(--sce-graphite) !important;
  border-color: var(--border-color) !important;
}

html.sce-theme-dark .form-control,
html.sce-theme-dark .input-with-feedback,
html.sce-theme-dark .frappe-control input,
html.sce-theme-dark .frappe-control textarea,
html.sce-theme-dark .frappe-control select {
  color: var(--sce-white) !important;
  background: var(--sce-soft-black) !important;
  border-color: #454545 !important;
}

html.sce-theme-dark .btn-default,
html.sce-theme-dark .btn-secondary {
  color: var(--sce-white);
  background: #303030;
  border-color: #555;
}

html.sce-theme-dark .page-card .btn-default,
html.sce-theme-dark .page-card .btn-login-option,
html.sce-theme-dark .login-content .btn-default {
  color: var(--sce-white) !important;
  background: #303030 !important;
  border-color: #555 !important;
}

html.sce-theme-dark .page-card .btn-default:hover,
html.sce-theme-dark .page-card .btn-login-option:hover,
html.sce-theme-dark .login-content .btn-default:hover {
  color: var(--sce-white) !important;
  background: #3a3a3a !important;
  border-color: #777 !important;
}

html.sce-theme-dark .btn-default:hover,
html.sce-theme-dark .btn-secondary:hover {
  color: var(--sce-white);
  background: #3a3a3a;
  border-color: #777;
}

html.sce-theme-dark .list-row-head,
html.sce-theme-dark .grid-heading-row,
html.sce-theme-dark .report-table thead th {
  color: var(--sce-white);
  background: var(--sce-soft-black);
}

html.sce-theme-dark .list-row,
html.sce-theme-dark .grid-row,
html.sce-theme-dark .report-table td {
  color: var(--text-color);
  border-color: var(--border-color);
}

html.sce-theme-dark .muted,
html.sce-theme-dark .text-muted,
html.sce-theme-dark .text-extra-muted {
  color: var(--sce-mid-gray) !important;
}

html.sce-theme-dark .standard-sidebar-item.selected,
html.sce-theme-dark .standard-sidebar-item.active,
html.sce-theme-dark .desk-sidebar .standard-sidebar-item.selected,
html.sce-theme-dark .layout-side-section .sidebar-item-container.selected {
  color: #e05a53 !important;
  background: rgba(217, 74, 66, 0.14) !important;
  box-shadow: inset 3px 0 0 #d94a42;
}

html.sce-theme-dark .dropdown-menu {
  color: var(--text-color);
  background: var(--sce-soft-black);
  border-color: #444;
}

html.sce-theme-dark .dropdown-item,
html.sce-theme-dark .dropdown-item:hover,
html.sce-theme-dark .dropdown-item:focus {
  color: var(--text-color);
}

html.sce-theme-dark .dropdown-item:hover,
html.sce-theme-dark .dropdown-item:focus,
html.sce-theme-dark .dropdown-item.active {
  background: rgba(217, 74, 66, 0.14);
}

html.sce-theme-dark body[data-path="login"],
html.sce-theme-dark body.login-page,
html.sce-theme-dark .login-page {
  background: linear-gradient(115deg, #101010 0 34%, var(--sce-graphite) 34% 100%) !important;
}

html.sce-theme-dark .page-card-head h4,
html.sce-theme-dark .page-card-head,
html.sce-theme-dark .login-content h4 {
  color: var(--sce-white) !important;
}

html.sce-theme-dark .page-card-head img.app-logo {
  background: transparent;
}

.sce-theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  color: var(--sce-white);
  background: var(--sce-graphite);
  border: 1px solid #454545;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(30, 30, 30, 0.22);
  font-family: var(--sce-font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sce-theme-toggle:hover {
  background: var(--sce-soft-black);
  border-color: var(--sce-red);
}

html.sce-theme-dark .sce-theme-toggle {
  color: var(--sce-graphite);
  background: var(--sce-white);
  border-color: var(--sce-white);
}

html.sce-theme-dark .sce-theme-toggle:hover {
  background: var(--sce-light-gray);
  border-color: #d94a42;
}

@media (max-width: 767px) {
  .sce-theme-toggle {
    right: 12px;
    bottom: 12px;
    min-height: 36px;
    padding: 7px 11px;
  }
}
