:root,
html[data-theme="light"] {
  --primary: #2458d3;
  --secondary: #12213f;
  --accent: #dce8ff;
  --header-color: #f8fafc;
  --header-branding-color: #fff;
  --header-bg: #12213f;
  --header-link-color: #dbe5f5;
  --breadcrumbs-fg: #667085;
  --breadcrumbs-link-fg: #344054;
  --breadcrumbs-bg: #fff;
  --body-bg: #f4f6fa;
  --body-fg: #172033;
  --body-quiet-color: #667085;
  --hairline-color: #e4e7ec;
  --border-color: #d0d5dd;
  --darkened-bg: #f8fafc;
  --selected-bg: #eef4ff;
  --selected-row: #f4f7ff;
  --button-bg: #2458d3;
  --button-hover-bg: #1e49b4;
  --default-button-bg: #2458d3;
  --default-button-hover-bg: #1e49b4;
}

html[data-theme="dark"] {
  --primary: #6f96f5;
  --primary-fg: #08111f;
  --secondary: #14213a;
  --accent: #b9cdfc;
  --header-color: #f3f6fc;
  --header-branding-color: #fff;
  --header-bg: #0a1220;
  --header-link-color: #c4cfe0;
  --breadcrumbs-fg: #93a1b7;
  --breadcrumbs-link-fg: #b9cdfc;
  --breadcrumbs-bg: #111a2a;
  --body-bg: #0d1421;
  --body-fg: #e7ebf2;
  --body-quiet-color: #9aa8bc;
  --body-medium-color: #c4cbd7;
  --body-loud-color: #fff;
  --link-fg: #8fb0ff;
  --link-hover-color: #b7cbff;
  --link-selected-fg: #cfdbff;
  --hairline-color: #253147;
  --border-color: #344159;
  --darkened-bg: #151e2d;
  --selected-bg: #192943;
  --selected-row: #172b49;
  --button-bg: #3f6fd7;
  --button-hover-bg: #527fe1;
  --default-button-bg: #3f6fd7;
  --default-button-hover-bg: #527fe1;
  --close-button-bg: #263248;
  --close-button-hover-bg: #344159;
  color-scheme: dark;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.005em;
}

#header {
  min-height: 66px;
  padding: 0 1.6rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 8px 24px rgba(15, 23, 42, .12);
}

#branding { display: flex; align-items: center; }
#site-name { margin: 0; }
#site-name a {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--header-branding-color);
}
#site-name a > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
#site-name strong { font-size: 1.05rem; font-weight: 720; letter-spacing: -.02em; }
#site-name small { margin-top: .22rem; color: #aebbd0; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.hedego-brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #163876;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .16);
  font-size: 1rem;
  font-weight: 800;
}

#user-tools { display: flex; align-items: center; gap: .35rem; color: #aebbd0; }
#user-tools a, #logout-form button { padding: .42rem .55rem; border-radius: 7px; }
#user-tools a:hover, #logout-form button:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.theme-toggle { border-radius: 8px; }

nav[aria-label="Guía-rastro"] { border-bottom: 1px solid var(--hairline-color); }
div.breadcrumbs { padding: .8rem 1.75rem; font-size: .78rem; }

.main > .content { min-width: 0; }
#content { padding: 1.8rem 2rem 2.8rem; }
#content h1 { margin: 0 0 1.35rem; font-size: 1.65rem; font-weight: 720; letter-spacing: -.035em; }
#content h2 { letter-spacing: -.015em; }

#nav-sidebar {
  border-right: 1px solid var(--hairline-color);
  box-shadow: 8px 0 28px rgba(15, 23, 42, .035);
}
#nav-filter {
  width: calc(100% - 1.4rem);
  margin: .9rem .7rem;
  padding: .65rem .75rem;
  background: var(--body-bg);
  border: 1px solid var(--border-color);
  border-radius: 9px;
}
#nav-sidebar .module { margin: 0 .65rem .8rem; border: 0; box-shadow: none; }
#nav-sidebar .module caption { padding: .7rem .75rem .45rem; background: transparent; }
#nav-sidebar .module caption a { color: var(--body-quiet-color); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; }
#nav-sidebar .module th, #nav-sidebar .module td { border: 0; }
#nav-sidebar .module tr { border-radius: 8px; }
#nav-sidebar .module tr.current-model { background: var(--selected-bg); }
#nav-sidebar .module th a { display: block; padding: .55rem .7rem; border-radius: 8px; font-weight: 600; }
#nav-sidebar .module td { padding-right: .45rem; }
.toggle-nav-sidebar { border-right-color: var(--hairline-color); }

.module,
fieldset.module,
#changelist-filter,
.inline-group {
  overflow: hidden;
  background: var(--body-bg);
  border: 1px solid var(--hairline-color);
  border-radius: 13px;
  box-shadow: 0 7px 22px rgba(16, 24, 40, .045);
}
.module caption,
.inline-group h2,
fieldset.module > h2 {
  padding: .8rem 1rem;
  background: color-mix(in srgb, var(--primary) 6%, var(--body-bg));
  border-bottom: 1px solid var(--hairline-color);
}
.module caption a, .inline-group h2, fieldset.module > h2 { color: var(--body-fg); font-weight: 700; }
.module table { border-collapse: separate; border-spacing: 0; }
.module tbody tr:last-child td, .module tbody tr:last-child th { border-bottom: 0; }
.module tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }

#changelist .results { border: 1px solid var(--hairline-color); border-radius: 13px; box-shadow: 0 7px 22px rgba(16, 24, 40, .04); }
#changelist .results table { overflow: hidden; border-radius: 13px; }
#changelist table thead th { padding: .8rem .65rem; background: var(--darkened-bg); }
#changelist table tbody td, #changelist table tbody th { padding: .8rem .65rem; }
#changelist-filter { top: 0; }
#changelist-filter h2 { padding: .85rem 1rem; }
#changelist-filter h3 { margin: .8rem 1rem .35rem; }
#changelist-filter ul { margin: 0 1rem 1rem; }

.form-row { padding: 1rem 1.15rem; border-bottom-color: var(--hairline-color); }
.form-row:last-child { border-bottom: 0; }
.aligned label { color: var(--body-quiet-color); font-weight: 650; }
input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="tel"], input[type="date"], textarea, select,
.select2-container--admin-autocomplete .select2-selection {
  min-height: 38px;
  padding: .52rem .65rem;
  color: var(--body-fg);
  background: var(--body-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
textarea { min-height: 90px; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); outline: none; }

.button, input[type="submit"], input[type="button"], .submit-row input, a.button {
  min-height: 36px;
  padding: .58rem .9rem;
  border-radius: 8px;
  font-weight: 650;
  letter-spacing: 0;
  box-shadow: none;
}
.submit-row { padding: .85rem 1rem; background: var(--darkened-bg); border: 1px solid var(--hairline-color); border-radius: 12px; }
.object-tools a { padding: .58rem .85rem; border-radius: 8px; }
.object-tools a:link, .object-tools a:visited { background: var(--secondary); }

ul.messagelist { margin: 0 0 1rem; padding: 0; }
ul.messagelist li { border: 1px solid color-mix(in srgb, #16a34a 30%, var(--hairline-color)); border-radius: 10px; box-shadow: 0 5px 15px rgba(16, 24, 40, .04); }
.paginator { border-radius: 10px; }

.hedego-dashboard-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.25rem;
  padding: 1.5rem 1.6rem;
  color: #f8fafc;
  background: linear-gradient(135deg, #12213f 0%, #1c3f82 100%);
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(18, 33, 63, .18);
}
.hedego-dashboard-intro h1 { margin: .15rem 0 .35rem !important; color: #fff; }
.hedego-dashboard-intro p { margin: 0; color: #c7d4e9; line-height: 1.5; }
.hedego-dashboard-eyebrow { color: #9db9ef !important; font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.hedego-quick-actions { display: flex; flex-wrap: wrap; gap: .55rem; min-width: fit-content; }
.hedego-quick-actions a { padding: .65rem .8rem; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 9px; font-weight: 650; }
.hedego-quick-actions a:hover { background: rgba(255,255,255,.17); }
.dashboard #content { width: auto; }
.dashboard #content-main { width: auto; }
.dashboard .module { margin-bottom: 1rem; }
.dashboard #content-related { width: 300px; margin-right: 0; }
.dashboard #content-related .module { border-radius: 13px; }
.dashboard #content-related h2 { border-radius: 0; }
.dashboard #content-related h3 { color: var(--body-quiet-color); }

@media (max-width: 1024px) {
  #content { padding: 1.4rem; }
  .hedego-dashboard-intro { align-items: flex-start; flex-direction: column; }
  .dashboard #content-related { width: 100%; }
}

@media (max-width: 767px) {
  #header { min-height: 58px; padding: .65rem 1rem; }
  #user-tools { gap: .1rem; }
  #site-name small { display: none; }
  div.breadcrumbs { padding: .7rem 1rem; }
  #content { padding: 1rem; }
  #content h1 { font-size: 1.4rem; }
  .hedego-dashboard-intro { padding: 1.2rem; }
  .hedego-quick-actions { min-width: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  a, button, input, select, textarea { transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease; }
}
