:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #202b32;
  --muted: #6f7b84;
  --line: #e3e8eb;

  --blue: #184b83;
  --blue-dark: #103a68;
  --blue-soft: #eaf3fb;

  --red: #ed1c24;

  --success: #237657;
  --success-soft: #e9f6f0;

  --danger: #ae393d;
  --danger-soft: #fbecee;

  --sidebar: #132a3c;

  --shadow: 0 8px 30px rgba(26, 44, 58, .06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  position: sticky;
  top: 0;

  height: 100vh;

  display: flex;
  flex-direction: column;

  padding: 27px 18px;

  color: #ffffff;
  background:
    linear-gradient(
      160deg,
      #132f46,
      #102331
    );
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 8px;
  margin-bottom: 38px;
}

.brand-symbol {
  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  border-radius: 11px;

  background: #ffffff;
  color: var(--blue);

  font-size: 21px;
  font-weight: 850;
}

.brand strong {
  display: block;
  font-size: 17px;
}

.brand span {
  display: block;

  margin-top: 1px;

  font-size: 12px;
  color: rgba(255,255,255,.58);
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.sidebar nav a {
  display: block;

  padding: 11px 13px;

  border-radius: 9px;

  font-size: 14px;
  font-weight: 600;

  color: rgba(255,255,255,.68);
}

.sidebar nav a:hover {
  color: #ffffff;
  background: rgba(255,255,255,.065);
}

.sidebar nav a.active {
  color: #ffffff;
  background: rgba(255,255,255,.11);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 8px 0;

  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-footer strong,
.sidebar-footer span {
  display: block;
}

.sidebar-footer strong {
  font-size: 12px;
}

.sidebar-footer span {
  margin-top: 2px;

  font-size: 11px;
  color: rgba(255,255,255,.45);
}

.sidebar-footer a {
  display: inline-block;

  margin-top: 16px;

  font-size: 12px;
  color: rgba(255,255,255,.62);
}

/* MAIN */

.main {
  width: 100%;
  max-width: 1500px;

  padding: 40px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;

  margin-bottom: 27px;
}

.page-header h1 {
  margin: 4px 0 6px;

  font-size: 31px;
  line-height: 1.12;

  letter-spacing: -1px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: block;

  color: var(--blue);

  font-size: 11px;
  font-weight: 800;

  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-top: 10px;

  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* BUTTONS */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 41px;

  padding: 10px 16px;

  border: 0;
  border-radius: 8px;

  font-size: 13px;
  font-weight: 750;

  transition: .15s ease;
}

.button.primary {
  color: #ffffff;
  background: var(--blue);
}

.button.primary:hover {
  background: var(--blue-dark);
}

.button.secondary {
  color: #37454f;
  background: #edf1f3;
}

.button.secondary:hover {
  background: #e3e8eb;
}

.button.full {
  width: 100%;
}

.button.disabled {
  color: #8e979d;
  background: #edf0f2;

  cursor: not-allowed;
}

.button-link {
  border: 0;
  padding: 0;
  background: transparent;
}

/* PANELS */

.panel {
  margin-bottom: 22px;
  padding: 24px;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.narrow {
  max-width: 800px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 22px;
}

.panel-heading h2 {
  margin: 0 0 4px;

  font-size: 18px;
  letter-spacing: -.25px;
}

.panel-heading p {
  margin: 0;

  color: var(--muted);
  font-size: 13px;
}

/* METRICS */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;

  margin-bottom: 22px;
}

.metrics article {
  padding: 21px;

  border: 1px solid var(--line);
  border-radius: 13px;

  background: #ffffff;
  box-shadow: var(--shadow);
}

.metrics article span {
  display: block;

  margin-bottom: 13px;

  color: var(--muted);
  font-size: 12px;
}

.metrics article strong {
  font-size: 27px;
  letter-spacing: -.5px;
}

.success-text {
  color: var(--success);
}

/* FORMS */

label {
  display: block;

  margin: 0 0 7px;

  color: #37434b;

  font-size: 12px;
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;

  padding: 11px 12px;

  border: 1px solid #ccd5da;
  border-radius: 8px;

  background: #ffffff;
  color: var(--text);

  outline: none;
}

input {
  height: 42px;
}

textarea {
  resize: vertical;
  min-height: 100px;

  line-height: 1.55;
}

select {
  height: 42px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(24,75,131,.09);
}

form > input,
form > textarea,
form > select {
  margin-bottom: 18px;
}

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

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0,1fr));
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  margin-top: 17px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 10px;
}

.inline-form input {
  margin: 0;
}

/* TABLE */

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 11px;

  border-top: 1px solid var(--line);

  text-align: left;
  vertical-align: middle;
}

th {
  color: #7b868d;

  font-size: 10px;
  font-weight: 800;

  letter-spacing: .7px;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

.right {
  text-align: right;
}

.table-action {
  color: var(--blue);

  font-size: 12px;
  font-weight: 750;
}

/* BADGES */

.badge {
  display: inline-flex;
  align-items: center;

  padding: 5px 9px;

  border-radius: 99px;

  background: #edf1f3;
  color: #59656d;

  font-size: 11px;
  font-weight: 750;
}

.badge.green {
  color: var(--success);
  background: var(--success-soft);
}

.badge.red {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.gray {
  color: #79838a;
}

/* ALERT */

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;

  border-radius: 8px;

  font-size: 13px;
}

.alert.success {
  color: var(--success);
  background: var(--success-soft);
}

.alert.error {
  color: var(--danger);
  background: var(--danger-soft);
}

/* EMPTY */

.empty {
  padding: 42px 20px;

  color: var(--muted);
  text-align: center;
}

.empty strong {
  display: block;

  margin-bottom: 5px;

  color: var(--text);
}

/* LOGIN */

.login-page {
  min-height: 100vh;

  display: grid;
  place-items: center;

  padding: 24px;

  background:
    radial-gradient(
      circle at 20% 5%,
      rgba(24,75,131,.12),
      transparent 32%
    ),
    radial-gradient(
      circle at 92% 90%,
      rgba(237,28,36,.06),
      transparent 30%
    ),
    #f5f7f8;
}

.login-card {
  width: min(425px, 100%);

  padding: 35px;

  border: 1px solid var(--line);
  border-radius: 18px;

  background: #ffffff;

  box-shadow:
    0 22px 65px rgba(25,42,54,.09);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 15px;

  margin-bottom: 30px;
}

.login-logo {
  width: 52px;
  height: 52px;

  display: grid;
  place-items: center;

  border-radius: 14px;

  background: var(--blue);
  color: #ffffff;

  font-size: 26px;
  font-weight: 850;

  box-shadow:
    inset 0 -4px 0 var(--red);
}

.login-brand h1 {
  margin: 1px 0 2px;

  font-size: 24px;
}

.login-brand p {
  margin: 0;

  color: var(--muted);
  font-size: 12px;
}

/* EDITOR */

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 23px;
  align-items: start;
}

.editor-main {
  min-width: 0;
}

.editor-section {
  margin-top: 31px;
}

.section-title-row {
  margin-bottom: 17px;
}

.section-title-row h2 {
  margin: 4px 0 0;

  font-size: 21px;
}

.content-block {
  position: relative;

  margin-bottom: 16px;
  padding: 23px;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: #ffffff;
  box-shadow: var(--shadow);
}

.block-heading {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 21px;
}

.block-heading > div:last-child strong,
.block-heading > div:last-child span {
  display: block;
}

.block-heading > div:last-child strong {
  font-size: 14px;
}

.block-heading > div:last-child span {
  margin-top: 2px;

  color: var(--muted);
  font-size: 12px;
}

.block-index {
  width: 34px;
  height: 34px;

  display: grid;
  place-items: center;

  border-radius: 9px;

  color: var(--blue);
  background: var(--blue-soft);

  font-size: 12px;
  font-weight: 800;
}

.block-save {
  display: flex;
  justify-content: flex-end;
}

.block-actions {
  display: flex;
  gap: 6px;

  margin-top: 17px;
  padding-top: 14px;

  border-top: 1px solid var(--line);
}

.block-actions form {
  margin: 0;
}

.mini-button {
  min-width: 34px;
  height: 31px;

  border: 0;
  border-radius: 7px;

  color: #52606a;
  background: #eef2f4;

  font-size: 12px;
  font-weight: 750;
}

.mini-button:hover:not(:disabled) {
  background: #e1e7ea;
}

.mini-button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.mini-button.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.current-image {
  margin: 0 0 14px;
}

.current-image img {
  display: block;

  max-width: 280px;
  max-height: 170px;

  border-radius: 8px;
  border: 1px solid var(--line);

  object-fit: cover;
}

.add-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;

  margin-top: 17px;
}

.add-block form {
  margin: 0;
}

.add-block-button {
  width: 100%;
  min-height: 84px;

  padding: 15px;

  border: 1px dashed #bdc9cf;
  border-radius: 12px;

  background: rgba(255,255,255,.55);

  text-align: left;

  transition: .15s ease;
}

.add-block-button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.add-block-button strong,
.add-block-button span {
  display: block;
}

.add-block-button strong {
  color: var(--blue);
  font-size: 13px;
}

.add-block-button span {
  margin-top: 5px;

  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.editor-empty {
  border: 1px dashed #cbd4d9;
  border-radius: 13px;

  background: rgba(255,255,255,.55);
}

.editor-side {
  min-width: 0;
}

.side-card {
  padding: 21px;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: #ffffff;
  box-shadow: var(--shadow);
}

.sticky {
  position: sticky;
  top: 25px;
}

.side-card h3 {
  margin: 5px 0 20px;

  font-size: 19px;
}

.side-stat {
  margin-bottom: 18px;
  padding: 15px;

  border-radius: 10px;

  background: #f5f7f8;
}

.side-stat span,
.side-stat strong {
  display: block;
}

.side-stat span {
  color: var(--muted);
  font-size: 11px;
}

.side-stat strong {
  margin-top: 4px;

  font-size: 24px;
}

.side-card hr {
  margin: 20px 0;

  border: 0;
  border-top: 1px solid var(--line);
}

.side-note {
  margin-top: 21px;
  padding-top: 20px;

  border-top: 1px solid var(--line);
}

.side-note strong {
  font-size: 12px;
}

.side-note p {
  margin: 6px 0 13px;

  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* SPONSORS */

.sponsors-box {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;

  margin-top: 3px;
  padding: 17px;

  border-radius: 10px;

  background: #f6f8f9;
}

.sponsors-box > div {
  margin-right: auto;
}

.sponsors-box strong,
.sponsors-box span {
  display: block;
}

.sponsors-box strong {
  font-size: 13px;
}

.sponsors-box span {
  margin-top: 2px;

  color: var(--muted);
  font-size: 11px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;

  margin: 0;

  font-weight: 600;
}

.check-row input {
  width: 16px;
  height: 16px;

  margin: 0;
}

/* SYSTEM */

.system-row {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 17px 2px;

  border-top: 1px solid var(--line);
}

.system-row:first-child {
  border-top: 0;
}

.system-row strong,
.system-row div span {
  display: block;
}

.system-row strong {
  font-size: 13px;
}

.system-row div span {
  margin-top: 3px;

  color: var(--muted);
  font-size: 11px;
}

/* RESPONSIVE */

@media (max-width: 1100px) {

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .sticky {
    position: static;
  }

  .editor-side {
    max-width: none;
  }

}

@media (max-width: 900px) {

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 24px;
  }

  .metrics {
    grid-template-columns:
      repeat(2, minmax(0,1fr));
  }

  .inline-form,
  .form-grid.two,
  .add-block {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

}

/* =====================================================
   HTML EDITOR
   ===================================================== */

.editor-mode-panel {
  padding: 18px 22px;
}

.mode-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
}

.mode-heading h2 {
  margin: 4px 0 3px;
  font-size: 17px;
}

.mode-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-buttons {
  display: flex;
  padding: 4px;
  border-radius: 9px;
  background: #eef2f4;
}

.mode-buttons form {
  margin: 0;
}

.mode-button {
  min-height: 35px;
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #65717a;
  font-size: 12px;
  font-weight: 750;
}

.mode-button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 1px 5px rgba(20,40,55,.1);
}

.builder-hidden {
  display: none;
}

.code-panel {
  padding: 0;
  overflow: hidden;
}

.code-panel .panel-heading {
  padding: 22px 24px 0;
}

.html-import-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;

  margin: 0 24px 20px;
  padding: 15px 17px;

  border: 1px solid #dce3e7;
  border-radius: 10px;

  background: #f7f9fa;
}

.html-import-box strong,
.html-import-box span {
  display: block;
}

.html-import-box strong {
  font-size: 12px;
}

.html-import-box span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.html-upload-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.html-upload-form input {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  font-size: 11px;
}

.code-panel > form {
  margin: 0;
}

.code-editor {
  display: block;

  width: 100%;
  min-height: 690px;

  margin: 0;
  padding: 22px 24px;

  border: 0;
  border-top: 1px solid #e2e7ea;
  border-bottom: 1px solid #e2e7ea;
  border-radius: 0;

  resize: vertical;

  background: #111820;
  color: #d9e1e7;

  font-family:
    "Cascadia Code",
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;

  font-size: 12px;
  line-height: 1.55;

  tab-size: 2;
  white-space: pre;
}

.code-editor:focus {
  border-color: #e2e7ea;
  box-shadow: none;
}

.code-help {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;

  padding: 11px 24px;

  background: #f6f8f9;
  color: #758089;

  font-family: monospace;
  font-size: 10px;
}

.code-panel .form-actions {
  padding: 15px 24px 22px;
  margin: 0;
}

@media (max-width: 800px) {
  .mode-heading,
  .html-import-box {
    align-items: stretch;
    flex-direction: column;
  }

  .html-upload-form {
    align-items: stretch;
    flex-direction: column;
  }
}

/* =====================================================
   GORC MAILING v0.3
   CONTACT IMPORT + REAL SEND
   ===================================================== */

.contact-import-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-import-form input[type="file"] {
  margin: 0;
  height: auto;
  max-width: 520px;
}

.button.send {
  color: #ffffff;
  background: var(--red);
}

.button.send:hover {
  background: #c91920;
}

/*
 * En modo HTML ocultamos el constructor,
 * pero NO el panel de pruebas/envío.
 */

.editor-layout.builder-hidden {
  display: grid;
  grid-template-columns: 1fr;
}

.editor-layout.builder-hidden .editor-main {
  display: none;
}

.editor-layout.builder-hidden .editor-side {
  width: 100%;
  max-width: 380px;
}

.confirm-send-panel {
  max-width: 780px;
}

.send-summary {
  display: grid;
  grid-template-columns: 2fr .7fr 1fr;
  gap: 12px;

  margin-bottom: 24px;
}

.send-summary > div {
  padding: 16px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: #f7f9fa;
}

.send-summary span,
.send-summary strong {
  display: block;
}

.send-summary span {
  margin-bottom: 6px;

  color: var(--muted);
  font-size: 10px;
  font-weight: 750;

  letter-spacing: .6px;
  text-transform: uppercase;
}

.send-summary strong {
  font-size: 14px;
  line-height: 1.4;
}

.real-send-warning {
  margin-bottom: 22px;
  padding: 17px 18px;

  border-left: 4px solid var(--red);
  border-radius: 7px;

  background: #fff4f4;
}

.real-send-warning strong {
  color: #9b2429;
  font-size: 13px;
}

.real-send-warning p {
  margin: 6px 0 0;

  color: #5f5657;
  font-size: 12px;
  line-height: 1.6;
}

.send-metrics article strong {
  font-size: 26px;
}

@media (max-width: 800px) {

  .contact-import-form {
    align-items: stretch;
    flex-direction: column;
  }

  .send-summary {
    grid-template-columns: 1fr;
  }

}


/* =====================================================
   GORC MAILING v0.4
   CAMPAIGN ANALYTICS
   ===================================================== */

.stats-metrics {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

.stats-metrics article {
  min-height: 126px;
}

.stats-metrics small {
  display: block;

  margin-top: 6px;

  color: var(--muted);

  font-size: 12px;
  font-weight: 650;
}


.stats-secondary {
  display: grid;

  grid-template-columns:
    repeat(5, minmax(0, 1fr));

  gap: 10px;
}


.stats-secondary > div {
  padding: 15px 16px;

  border: 1px solid var(--line);

  border-radius: 9px;

  background: #f7f9fa;
}


.stats-secondary span,
.stats-secondary strong {
  display: block;
}


.stats-secondary span {
  margin-bottom: 5px;

  color: var(--muted);

  font-size: 10px;
  font-weight: 750;

  letter-spacing: .5px;

  text-transform: uppercase;
}


.stats-secondary strong {
  color: var(--blue);

  font-size: 21px;
}


.table-scroll {
  width: 100%;

  overflow-x: auto;
}


.stats-table {
  width: 100%;

  border-collapse: collapse;
}


.stats-table th {
  padding: 10px 12px;

  border-bottom:
    1px solid var(--line);

  color: var(--muted);

  font-size: 10px;
  font-weight: 750;

  letter-spacing: .45px;

  text-align: left;
  text-transform: uppercase;
}


.stats-table td {
  padding: 12px;

  border-bottom:
    1px solid #edf0f2;

  vertical-align: top;

  font-size: 11px;
}


.stats-table tbody tr:hover {
  background: #fafbfc;
}


.url-cell {
  max-width: 620px;

  word-break: break-all;
}


.url-cell a {
  color: var(--blue);

  text-decoration: none;
}


.url-cell a:hover {
  text-decoration: underline;
}


.recipient-email {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 10px;
}


.delivery-status {
  display: inline-block;

  padding: 4px 7px;

  border-radius: 20px;

  background: #eef2f4;

  font-size: 9px;
  font-weight: 750;
}


.status-sent {
  background: #e9f7ef;

  color: #247748;
}


.status-failed {
  background: #fff0f0;

  color: #a72a30;
}


.status-skipped {
  background: #f3f4f5;

  color: #69747b;
}


.status-queued,
.status-sending {
  background: #fff8dd;

  color: #866612;
}


.delivery-error {
  display: block;

  max-width: 300px;

  margin-top: 5px;

  color: #a72a30;

  font-size: 9px;
  line-height: 1.4;
}


.yes-badge {
  display: inline-block;

  padding: 4px 7px;

  border-radius: 20px;

  background: #fff0f0;

  color: #a72a30;

  font-size: 9px;
  font-weight: 750;
}


.small-empty {
  padding: 28px !important;

  font-size: 12px;
}


@media (max-width: 1050px) {

  .stats-metrics {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .stats-secondary {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

}


@media (max-width: 650px) {

  .stats-metrics,
  .stats-secondary {
    grid-template-columns: 1fr;
  }

}

