:root {
  --dark: #233738;
  --mint: #5fe4a2;
  --heading: #2e7d5b;
  --text: #2d4747;
  --muted: #748784;
  --border: #e1e7e6;
  --soft: #f3f6f5;
  --bad: #b0413e;
  --radius: 9px;
  --shadow: 0 1px 3px rgba(20, 40, 40, 0.08), 0 4px 16px rgba(20, 40, 40, 0.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #eef2f1;
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
a { color: var(--heading); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--dark); color: #eaf1ef; padding: 12px 22px;
  border-bottom: 4px solid var(--mint);
}
.topbar .brand { font-weight: 700; letter-spacing: 0.02em; font-size: 16px; }
.topbar .brand b { color: var(--mint); }
.spacer { flex: 1; }
.badge { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,.12); color: #eaf1ef; }
.badge.on { background: rgba(95,228,162,.22); color: var(--mint); }
/* Botones sobre la barra oscura: texto claro y borde tenue. */
.topbar .btn.ghost { color: #eaf1ef; border-color: rgba(255,255,255,.35); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.12); }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 57px); }
.sidebar {
  width: 270px; background: #fff; border-right: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.side-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.client-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.client-list li { padding: 10px 12px; border-radius: var(--radius); cursor: pointer; display: flex; align-items: center; gap: 9px; }
.client-list li:hover { background: var(--soft); }
.client-list li.active { background: var(--dark); color: #fff; }
.client-list li .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); flex: none; }
.main { flex: 1; padding: 26px 32px; overflow: auto; }
.empty { color: var(--muted); margin-top: 40px; text-align: center; }

/* Buttons */
.btn { background: var(--dark); color: #fff; border: none; padding: 9px 16px; border-radius: var(--radius); font-weight: 600; font-size: 13px; }
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: var(--heading); }
.btn.mint { background: var(--mint); color: #143; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid #eccfce; }
.btn:disabled { opacity: .5; cursor: default; }

/* Cards / panels */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card h3 { margin: 0 0 12px; font-size: 14px; color: var(--heading); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input[type=text], .field input[type=date], .field textarea, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.field textarea { min-height: 80px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Calendario visual */
.cal-field { cursor: pointer; background: #fff; }
.cal-pop { background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; z-index: 200; width: 236px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 8px; color: var(--text); text-transform: capitalize; }
.cal-nav { border: none; background: var(--soft); border-radius: 6px; width: 28px; height: 28px; font-size: 16px; line-height: 1; color: var(--text); }
.cal-nav:hover { background: var(--border); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow span { text-align: center; font-size: 10px; color: var(--muted); padding: 3px 0; font-weight: 600; }
.cal-d { text-align: center; padding: 7px 0; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--text); }
.cal-d:hover { background: var(--soft); }
.cal-d.sel { background: var(--heading); color: #fff; font-weight: 600; }
.cal-d.empty { cursor: default; }
.headrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.headrow h1 { font-size: 22px; margin: 0; }
.crumb { color: var(--muted); font-size: 13px; cursor: pointer; }
.crumb:hover { color: var(--heading); }

/* Colors editor */
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.color-item { display: flex; align-items: center; gap: 8px; }
.color-item input[type=color] { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px; background: none; padding: 0; }
.color-item .meta { display: flex; flex-direction: column; }
.color-item .meta span { font-size: 11px; color: var(--muted); }
.color-item .meta input { width: 86px; border: none; font-size: 12px; color: var(--text); padding: 2px 0; }

/* Datasets */
.ds-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ds-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.ds-item .name { font-weight: 600; flex: 1; word-break: break-all; }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.tag.ok { background: #e6f0ec; color: var(--heading); }
.tag.unknown { background: #f7e9e8; color: var(--bad); }
.tag.kind { background: var(--soft); color: var(--muted); }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.dropzone.drag { border-color: var(--mint); background: #f2fbf7; color: var(--heading); }

/* Preview */
.preview { width: 100%; height: 820px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.reports-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.reports-list li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.reports-list li:hover { background: var(--soft); }
.reports-list li .r-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.reports-list li .r-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reports-list li .when { color: var(--muted); font-size: 12px; }
.reports-list li .r-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { padding: 8px 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.tab.active { background: var(--dark); color: #fff; border-color: var(--dark); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,35,35,.5); display: flex; align-items: flex-start; justify-content: center; padding: 50px 20px; z-index: 50; overflow: auto; }
.modal.hidden { display: none; }
.modal .box { background: #fff; border-radius: 14px; padding: 26px; width: 640px; max-width: 100%; box-shadow: var(--shadow); }
.modal .box h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 11px 20px; border-radius: 24px; box-shadow: var(--shadow); z-index: 100; opacity: 0; transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: r .7s linear infinite; vertical-align: -2px; }
@keyframes r { to { transform: rotate(360deg); } }
