:root {
  --bg:              #faf7f2;
  --bg-elevated:     #ffffff;
  --bg-soft:         #f3ede3;
  --bg-inset:        #ece4d6;
  --surface-subtle:  #f3ede3;

  --ink:             #1a1a17;
  --ink-1:           #1a1a17;
  --ink-2:           #3d3a33;
  --ink-3:           #6e6a60;
  --ink-4:           #9b968a;

  --line:            #e4ddd0;
  --line-strong:     #cdc4b3;

  --brand:           #2d4a3e;
  --brand-soft:      #e8efe9;
  --brand-ink:       #0f2419;

  --accent:          #d4622a;
  --accent-soft:     #fbe8db;
  --accent-ink:      #6b2f10;

  --success:              #3a7d44;
  --warning:              #d49b2a;
  --danger:               #b8412e;
  --status-pending:       #d49b2a;
  --status-pending-bg:    #fbf2dc;
  --status-assigned:      #2d5a8e;
  --status-assigned-bg:   #e0ebf6;
  --status-transit:       #7340a8;
  --status-transit-bg:    #ede2f7;
  --status-delivered:     #3a7d44;
  --status-delivered-bg:  #e2efd9;
  --status-expired:       #b8412e;
  --status-expired-bg:    #f7e0d9;

  --font-sans:    'Manrope', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --r-sm:      6px;
  --r-md:      10px;
  --r-lg:      16px;
  --r-xl:      24px;
  --r-full:    999px;
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --radius-xl: var(--r-xl);

  --sh-sm: 0 1px 2px rgba(20,18,12,0.04);
  --sh-md: 0 4px 12px rgba(20,18,12,0.06);
  --sh-lg: 0 12px 32px rgba(20,18,12,0.08);
  --sh-xl: 0 24px 64px rgba(20,18,12,0.12);
  --shadow-card: var(--sh-sm), var(--sh-md);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.font-display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; }
.font-mono    { font-family: var(--font-mono); }
.muted        { color: var(--ink-3); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.dt-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
}
.dt-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  position: relative;
  flex-shrink: 0;
}
.dt-logo-mark::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  top: 4px;
  right: 4px;
  background: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  min-height: 40px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending   { background: var(--status-pending-bg);   color: var(--status-pending); }
.badge-assigned  { background: var(--status-assigned-bg);  color: var(--status-assigned); }
.badge-transit   { background: var(--status-transit-bg);   color: var(--status-transit); }
.badge-delivered { background: var(--status-delivered-bg); color: var(--status-delivered); }
.badge-expired   { background: var(--status-expired-bg);   color: var(--status-expired); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.form-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 0 0 4px;
}
legend {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 0 6px;
}

.map-placeholder {
  background: var(--bg-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-3);
  text-align: center;
  padding: 24px;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.pub-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}
.pub-header-divider { width: 1px; background: var(--line); align-self: stretch; }
.pub-header-meta { margin-right: auto; }
.pub-header-meta-title { font-weight: 700; font-size: inherit; }
.pub-header-meta-sub   { font-size: 12px; color: var(--ink-3); }
.pub-header-actions    { display: flex; align-items: center; }

.pub-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-elevated);
  text-align: center;
  color: var(--ink-3);
}

.legal-body {
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.legal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}
.legal-header-nav { display: flex; align-items: center; }

.legal-main { flex: 1; margin: 0 auto; }
.legal-intro { text-align: center; }

.legal-section { margin-bottom: 32px; }
.legal-section:last-child { margin-bottom: 16px; }
.legal-section h2 {
  font-size: 20px;
  color: var(--ink-1);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.legal-section p  { font-size: 14px; margin-bottom: 12px; }
.legal-section ul { font-size: 14px; padding-left: 20px; margin-bottom: 12px; }
.legal-section li { margin-bottom: 6px; }

.mapa-shell { display: flex; flex-direction: column; min-height: 100vh; }

.mapa-filter-bar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.mapa-filter-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mapa-filtro {
  min-height: 32px;
  padding: 5px 12px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.mapa-filtro:hover  { background: var(--bg-inset); }
.mapa-filtro.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.mapa-layout { display: flex; flex: 1; }

.mapa-sidebar {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg-elevated);
}

.mapa-entity-btn {
  width: 100%;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  display: block;
  background: transparent;
  cursor: pointer;
}
.mapa-entity-btn:last-child { border-bottom: none; }
.mapa-entity-btn:disabled { cursor: default; opacity: .7; }
.mapa-entity-btn.active { background: var(--brand-soft); }
.mapa-entity-btn:hover:not(.active) { background: var(--bg-soft); }
.mapa-entity-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.mapa-entity-name   { font-weight: 700; font-size: 14px; }
.mapa-entity-id     { font-size: 11px; color: var(--ink-3); }
.mapa-entity-meta   { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.mapa-entity-tags   { display: flex; gap: 4px; flex-wrap: wrap; }
.mapa-etiqueta      { background: var(--bg-soft); color: var(--ink-2); font-size: 10px; }
.mapa-map           { flex: 1; border-radius: 0; border: none; min-height: 0; }

.auth-body {
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-card { width: 100%; background: var(--bg-elevated); }
.auth-card-header  { text-align: center; }
.auth-form         { display: flex; flex-direction: column; }
.auth-form-label   { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink-2); }
.auth-role-label   { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.auth-role-btns    { display: flex; flex-direction: column; }
.auth-footer       { text-align: center; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
.auth-footer a     { color: var(--brand); font-weight: 600; }

.form-grid { display: grid; gap: 14px; }

@media (min-width: 1025px) {

  .pub-header         { padding: 16px 32px; gap: 20px; }
  .pub-header-divider { display: block; }
  .pub-header-actions { gap: 16px; }
  .pub-footer         { padding: 24px; font-size: 13px; }

  .legal-header      { padding: 20px 48px; }
  .legal-header-nav  { gap: 20px; }
  .legal-main        { padding: 64px 24px; max-width: 800px; }
  .legal-intro       { margin-bottom: 40px; }
  .legal-intro h1    { font-size: 36px; margin: 12px 0 8px; }
  .legal-card        { padding: 40px; line-height: 1.7; color: var(--ink-2); }

  .mapa-filter-bar   { padding: 12px 24px; gap: 8px; }
  .mapa-filter-label { margin-right: 4px; }
  .mapa-sidebar      { width: 360px; flex-shrink: 0; }
  .mapa-layout       { height: calc(100vh - 130px); }

  .auth-body           { padding: 24px; }
  .auth-card           { max-width: 420px; padding: 32px; border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
  .auth-card.wide      { max-width: 480px; padding: 32px; }
  .auth-card-header    { margin-bottom: 24px; }
  .auth-card-header h2 { font-size: 24px; margin-top: 12px; margin-bottom: 4px; }
  .auth-form           { gap: 16px; }
  .auth-role-btns      { gap: 8px; margin-top: 8px; }
  .auth-footer         { margin-top: 24px; padding-top: 16px; }

  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) and (max-width: 1024px) {

  .pub-header         { padding: 14px 24px; gap: 16px; }
  .pub-header-divider { display: block; }
  .pub-header-actions { gap: 12px; }
  .pub-footer         { padding: 20px 24px; font-size: 13px; }

  .legal-header      { padding: 16px 24px; }
  .legal-header-nav  { gap: 14px; }
  .legal-main        { padding: 48px 24px; max-width: 720px; }
  .legal-intro       { margin-bottom: 32px; }
  .legal-intro h1    { font-size: 30px; margin: 10px 0 6px; }
  .legal-card        { padding: 28px; line-height: 1.65; color: var(--ink-2); }

  .mapa-filter-bar   { padding: 10px 20px; gap: 6px; }
  .mapa-filter-label { margin-right: 4px; }
  .mapa-sidebar      { width: 280px; flex-shrink: 0; }
  .mapa-layout       { height: calc(100vh - 122px); }

  .auth-body           { padding: 32px 24px; }
  .auth-card           { max-width: 420px; padding: 28px; border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
  .auth-card.wide      { max-width: 480px; padding: 28px; }
  .auth-card-header    { margin-bottom: 20px; }
  .auth-card-header h2 { font-size: 22px; margin-top: 10px; margin-bottom: 4px; }
  .auth-form           { gap: 14px; }
  .auth-role-btns      { gap: 8px; margin-top: 8px; }
  .auth-footer         { margin-top: 20px; padding-top: 14px; }

  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {

  .pub-header         { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .pub-header-divider { display: none; }
  .pub-header-meta    { display: none; }
  .pub-header-actions { gap: 8px; }
  .pub-footer         { padding: 16px; font-size: 12px; }

  .legal-header      { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .legal-header-nav  { gap: 10px; flex-wrap: wrap; }
  .legal-main        { padding: 32px 16px; max-width: 100%; }
  .legal-intro       { margin-bottom: 24px; }
  .legal-intro h1    { font-size: 24px; margin: 8px 0 4px; }
  .legal-card        { padding: 20px; line-height: 1.6; color: var(--ink-2); }
  .legal-section h2  { font-size: 17px; }

  .mapa-filter-bar   { padding: 8px 12px; gap: 6px; }
  .mapa-filter-label { width: 100%; margin-bottom: 2px; }
  .mapa-filtro       { min-height: 48px; padding: 12px 16px; }
  .mapa-layout       { flex-direction: column; height: auto; }
  .mapa-sidebar      { width: 100%; height: 260px; border-right: none; border-bottom: 1px solid var(--line); }
  .mapa-map          { min-height: 340px; }

  .auth-body           { padding: 20px 16px; align-items: flex-start; padding-top: 40px; }
  .auth-card           { max-width: 100%; padding: 24px 20px; border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
  .auth-card.wide      { max-width: 100%; padding: 24px 20px; }
  .auth-card-header    { margin-bottom: 20px; }
  .auth-card-header h2 { font-size: 22px; margin-top: 10px; margin-bottom: 4px; }
  .auth-form           { gap: 14px; }
  .auth-role-btns      { gap: 8px; margin-top: 8px; }
  .auth-footer         { margin-top: 20px; padding-top: 14px; }

  .btn { width: 100%; justify-content: center; }
  .auth-card .btn-sm { width: auto; }

  .form-grid { grid-template-columns: 1fr; }
}


@keyframes sk-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.sk-block {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    #ece4d6 0px,
    #f3ede3 180px,
    #ece4d6 360px
  );
  background-size: 600px 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

.sk-auth-wrap {
  position: fixed;
  inset: 0;
  background: #f3ede3;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.sk-auth-card {
  width: 100%;
  max-width: 420px;
  height: 380px;
  border-radius: 16px;
}

.sk-auth-card--wide {
  max-width: 480px;
}

.sk-pub-wrap {
  position: fixed;
  inset: 0;
  background: #faf7f2;
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

.sk-pub-header {
  width: 100%;
  height: 64px;
  border-radius: 0;
  flex-shrink: 0;
}

.sk-pub-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sk-pub-sidebar {
  width: 360px;
  flex-shrink: 0;
  height: 100%;
  border-radius: 0;
}

.sk-pub-map {
  flex: 1;
  height: 100%;
  border-radius: 0;
}

.sk-legal-wrap {
  position: fixed;
  inset: 0;
  background: #f3ede3;
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

.sk-legal-header {
  width: 100%;
  height: 64px;
  border-radius: 0;
  flex-shrink: 0;
}

.sk-legal-body {
  max-width: 800px;
  width: 100%;
  margin: 32px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sk-legal-title {
  width: 60%;
  height: 32px;
}

.sk-legal-content {
  width: 100%;
  height: 260px;
}

@media (min-width: 768px) and (max-width: 1024px) {
  .sk-pub-sidebar { width: 280px; }
  .sk-auth-card { max-width: 420px; }
  .sk-auth-card--wide { max-width: 480px; }
}

@media (max-width: 767px) {
  .sk-pub-body { flex-direction: column; }
  .sk-pub-sidebar { width: 100%; height: 260px; }
  .sk-pub-map { min-height: 340px; height: auto; }
  .sk-auth-card { max-width: 100%; height: 360px; }
  .sk-auth-card--wide { max-width: 100%; }
  .sk-legal-header { height: 52px; }
}