:root {
  --primary: #ff6a00;
  --secondary: #ff8b24;
  --dark: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --soft: #fff7ed;
  --bg: #f8fafc;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: 'Kanit', system-ui, sans-serif;
  font-weight: 400;
  color: var(--dark);
  background: var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 106, 0, .04), transparent 280px),
    radial-gradient(circle at 85% 4%, rgba(255, 106, 0, .08), transparent 260px);
  z-index: -1;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.login-logo { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .82rem;
  font-weight: 600;
}
h1, h2 { margin: 0; line-height: 1.08; letter-spacing: 0; font-weight: 600; }
.muted { color: var(--muted); line-height: 1.6; }
.stack { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 500;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--dark);
  padding: 12px 14px;
  outline: none;
}

textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, .12);
}

.btn, .icon-btn {
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn { min-height: 44px; padding: 11px 18px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; box-shadow: 0 12px 28px rgba(255, 106, 0, .22); }
.btn-ghost { background: #fff; color: var(--dark); border: 1px solid var(--line); }
.btn-dark { background: #111827; color: #fff; }
.icon-btn { width: 42px; height: 42px; background: #111827; color: #fff; font-size: 1.35rem; }
.error { min-height: 20px; color: #dc2626; margin: 0; }

.topbar {
  height: 72px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--dark); text-decoration: none; font-weight: 600; font-size: 1.18rem; }
.brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.dashboard-view {
  height: calc(100vh - 72px);
  overflow: hidden;
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.landings-view {
  height: calc(100vh - 72px);
  overflow: hidden;
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
}

.page-head {
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .06);
}

.page-head h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  border: 1px solid rgba(226, 232, 240, .95);
  background: rgba(255, 255, 255, .85);
  color: var(--dark);
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
}

.filter-chip.active {
  border-color: var(--primary);
  background: var(--soft);
  color: #9a3412;
}

.landings-table {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 16px 45px rgba(15, 23, 42, .07);
}

.landing-table-head,
.landing-row {
  display: grid;
  grid-template-columns: minmax(300px, 1.5fr) minmax(230px, 1fr) 120px 120px 120px 90px 90px 120px 100px;
  gap: 0;
  align-items: center;
  min-width: 1260px;
}

.landing-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: #475569;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.landing-table-head > div,
.landing-row > div {
  padding: 13px 14px;
  min-width: 0;
}

.landing-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .98);
  text-align: left;
  color: var(--dark);
  cursor: pointer;
  transition: background .15s ease;
}

.landing-row:hover { background: #fff7ed; }
.landing-row:last-child { border-bottom: 0; }

.landing-row strong {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landing-row small,
.landing-cell span {
  color: var(--muted);
  font-size: .86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landing-cell {
  display: grid;
  gap: 3px;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .82rem;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status-pill.publicada { background: #dcfce7; color: #166534; }
.status-pill.pendiente { background: #fef3c7; color: #92400e; }
.status-pill.borrador { background: #e2e8f0; color: #334155; }
.status-pill.subida { background: #dcfce7; color: #166534; }
.status-pill.no_publicada { background: #e2e8f0; color: #334155; }
.status-pill.error { background: #fee2e2; color: #991b1b; }

.url-cell a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

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

.row-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  border: 1px solid rgba(226, 232, 240, .95);
  background: #fff;
  color: var(--dark);
  border-radius: 999px;
  padding: 6px 8px;
  font-size: .82rem;
  font-weight: 700;
}

.mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dashboard-hero {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.dashboard-hero h1 {
  font-size: clamp(1.55rem, 2.4vw, 2.35rem);
  max-width: 720px;
}

.dashboard-hero p {
  margin-bottom: 0;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 16px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: .9rem;
}

.metric-card strong {
  display: block;
  font-size: 1.55rem;
  font-weight: 600;
}

.dashboard-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dashboard-panel {
  min-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 1.25rem;
}

.dashboard-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
}

.dashboard-item {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 11px 12px;
  text-align: left;
  color: var(--dark);
}

.dashboard-item strong {
  display: block;
  font-weight: 600;
}

.dashboard-item span {
  color: var(--muted);
  font-size: .9rem;
}

.layout {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 340px 1fr;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 22px;
}
.sidebar-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}
.landing-list { display: grid; gap: 10px; }
.landing-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--dark);
  padding: 14px;
  text-align: left;
}
.landing-item.active { border-color: var(--primary); background: var(--soft); }
.landing-title { font-weight: 600; display: block; }
.landing-meta { color: var(--muted); font-size: .9rem; margin-top: 4px; display: block; }
.badge {
  display: inline-flex;
  margin-top: 10px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .78rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}
.badge.publicada { background: #dcfce7; color: #166534; }
.badge.pendiente { background: #fef3c7; color: #92400e; }

.workspace { padding: 28px; min-width: 0; }
.empty-state {
  max-width: 780px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 38px;
}
.empty-state h1 { font-size: clamp(1.9rem, 3.4vw, 3.2rem); max-width: 720px; }
.empty-state p { max-width: 620px; color: var(--muted); font-size: 1.1rem; line-height: 1.65; }
.empty-actions, .bulk-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.bulk-box, .ideas-box, .knowledge-box, .tracking-box, .publish-info {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
}

.bulk-box {
  background: #f8fafc;
}

.bulk-box h2, .knowledge-box h2, .tracking-box h2 {
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.bulk-box p {
  color: var(--muted);
  margin-top: 0;
}

.check-row {
  display: inline-flex;
  grid-template-columns: auto;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.check-row input {
  width: auto;
}

.ideas-box {
  display: grid;
  gap: 12px;
}

.idea-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.idea-item strong {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.idea-item p {
  margin: 0;
  font-size: .98rem;
}

.editor { display: grid; gap: 22px; }
.editor > .form-grid {
  display: none;
}
.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.editor-head h1 { font-size: clamp(1.7rem, 2.5vw, 2.45rem); }
.status-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.status-row select { width: auto; min-width: 190px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.span-2 { grid-column: span 2; }

.knowledge-box {
  display: grid;
  gap: 16px;
}

.primary-workflow {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
}

.hero-field input {
  min-height: 54px;
  font-size: 1.08rem;
}

.geo-helper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.geo-helper > div,
.geo-helper .span-2 {
  grid-column: 1 / -1;
}

.geo-helper h3 {
  margin: 0 0 4px;
  font-weight: 600;
}

.geo-helper p {
  margin: 0;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  font-weight: 500;
}

.radio-row input {
  width: auto;
}

.knowledge-box .muted, .tracking-box .muted {
  max-width: 820px;
  margin-bottom: 0;
}

.tracking-box {
  display: grid;
  gap: 16px;
}

.publish-info {
  margin-top: 0;
  display: grid;
  gap: 10px;
  background: #fff;
}

.publish-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.publish-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.publish-stat span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
}

.publish-stat strong {
  display: block;
  margin-top: 3px;
  font-weight: 600;
}

.publish-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.badge.subida { background: #dcfce7; color: #166534; }
.badge.error { background: #fee2e2; color: #991b1b; }
.badge.pendiente_configuracion { background: #fef3c7; color: #92400e; }
.badge.no_publicada { background: #e2e8f0; color: #334155; }

.inner-grid {
  padding: 0;
  border: 0;
  background: transparent;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.tab {
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fff;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--muted);
}
.tab.active { color: var(--dark); background: var(--soft); border-color: #fed7aa; }
.tab-panel {
  display: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  gap: 16px;
}
.tab-panel.active { display: grid; }

.preview {
  display: grid;
  gap: 22px;
  max-width: 920px;
}
.preview-hero {
  padding: 34px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
  border: 1px solid #fed7aa;
}
.preview-hero h1 { font-size: clamp(1.9rem, 3.2vw, 3.5rem); margin: 8px 0 14px; font-weight: 600; }
.preview p, .preview li { color: var(--muted); line-height: 1.72; }
.preview-card { border: 1px solid var(--line); border-radius: 8px; padding: 22px; background: #fff; }

.social-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.social-head h2 {
  font-size: 1.35rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .28);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .dashboard-grid, .metric-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
  .geo-helper { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .editor-head { flex-direction: column; }
  .status-row { justify-content: flex-start; }
  .publish-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { height: auto; padding: 14px; align-items: flex-start; gap: 12px; flex-direction: column; }
  .workspace, .sidebar { padding: 16px; }
  .status-row, .topbar-actions { width: 100%; }
  .btn { width: 100%; }
  .dashboard-view { padding: 16px; }
  .landings-view { height: auto; min-height: calc(100vh - 72px); overflow: visible; padding: 16px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .dashboard-grid, .metric-grid { grid-template-columns: 1fr; }
  .dashboard-actions { width: 100%; }
  .publish-grid { grid-template-columns: 1fr; }
}
