/* ============================================================================
   Fluio Design System
   Sistema de diseño compartido para todas las herramientas internas.
   Importar con: <link rel="stylesheet" href="fluio-styles.css">
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --g:        #1a6b42;
  --g-light:  #e8f5ee;
  --g-mid:    #529e74;
  --g-soft:   #f0f8f3;
  --tan:      #c6b296;
  --red:      #c0392b;
  --red-soft: rgba(192,57,43,0.06);
  --orange:   #d97b2a;
  --orange-soft: rgba(217,123,42,0.06);

  /* Neutrals */
  --bg:      #f7f6f3;
  --white:   #ffffff;
  --ink:     #0f1c14;
  --ink2:    #3d4f44;
  --ink3:    #8a9e92;
  --border:  #dde8e2;
  --border-soft: #e8efe9;

  /* Effects */
  --radius-sm:  8px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --shadow-xs:  0 1px 3px rgba(15,28,20,0.04);
  --shadow-sm:  0 2px 8px rgba(15,28,20,0.05);
  --shadow:     0 2px 8px rgba(15,28,20,0.06), 0 12px 40px rgba(15,28,20,0.09);
  --shadow-lg:  0 4px 16px rgba(15,28,20,0.08), 0 24px 60px rgba(15,28,20,0.12);

  /* Fonts */
  --font-sans:  'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-mono:  'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
/* Mobile-first: 540px. Crece progresivamente en desktop. */
.page {
  max-width: 540px;
  margin: 0 auto;
  padding: 44px 20px 60px;
}
.page-wide {
  max-width: 540px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}
@media (min-width: 768px) {
  .page-wide { max-width: 720px; padding: 44px 24px 60px; }
}
@media (min-width: 1024px) {
  .page-wide { max-width: 960px; padding: 52px 32px 72px; }
}
@media (min-width: 1280px) {
  .page-wide { max-width: 1100px; padding: 60px 40px 80px; }
}

/* ── HEADER ─────────────────────────────────────────────────────────────── */
.hd { margin-bottom: 28px; animation: fadeDown 0.45s ease both; }
.hd-logo {
  display: block;
  height: 36px;
  width: auto;
  margin-bottom: 14px;
  margin-left: -4px;
  /* fondo blanco del PNG se mezcla con el fondo crema → invisible */
  mix-blend-mode: multiply;
}
@media (min-width: 768px) {
  .hd-logo { height: 42px; }
}
.hd-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--ink);
}
.hd-title em { font-style: italic; color: var(--g); }
.hd-sub {
  font-size: 13px;
  color: var(--ink3);
  margin-top: 8px;
}
@media (min-width: 768px) {
  .hd-title { font-size: 44px; letter-spacing: -1.2px; }
}

/* Header for wide pages (dashboard) — horizontal layout */
.hd-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.hd-row .hd-title { font-size: 30px; }
@media (min-width: 768px) {
  .hd-row .hd-title { font-size: 38px; }
}

/* ── CARD ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
  animation: fadeUp 0.4s 0.1s ease both;
}
@media (max-width: 460px) {
  .card { padding: 22px 18px 20px; }
}

/* ── FORM FIELDS ────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
}
.field:last-of-type { margin-bottom: 0; }

label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink2);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.label-hint {
  font-size: 11px;
  color: var(--ink3);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

.iw { position: relative; }
.pfx {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--g);
  pointer-events: none;
  font-weight: 500;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--g);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,107,66,0.08);
}
input.hp { padding-left: 36px; }
input::placeholder, textarea::placeholder {
  color: var(--ink3);
  font-weight: 300;
}
textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

/* Native select arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a9e92' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

/* ── RANGE SLIDER ───────────────────────────────────────────────────────── */
input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  background-image: linear-gradient(var(--g-mid), var(--g-mid));
  background-repeat: no-repeat;
  background-size: 0% 100%;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--g);
  cursor: pointer;
  border: 2.5px solid white;
  box-shadow: 0 1px 4px rgba(15,28,20,0.2);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--g);
  cursor: pointer;
  border: 2.5px solid white;
  box-shadow: 0 1px 4px rgba(15,28,20,0.2);
}

/* ── TOGGLE ─────────────────────────────────────────────────────────────── */
.tog {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  user-select: none;
}
.tog:hover { border-color: var(--g-mid); background: var(--g-soft); }
.tog.on { border-color: var(--g); background: var(--g-light); }
.tog-main { font-size: 14px; font-weight: 500; color: var(--ink); }
.tog-sub { font-size: 11px; color: var(--ink3); margin-top: 2px; }
.tsw {
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  margin-left: 16px;
  transition: background 0.22s;
}
.tog.on .tsw { background: var(--g); }
.tknob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.22s;
  box-shadow: 0 1px 3px rgba(15,28,20,0.2);
}
.tog.on .tknob { transform: translateX(18px); }

/* ── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--g);
  color: var(--g);
  background: var(--g-light);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--ink);
  color: var(--white);
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--g);
  color: var(--white);
  border-color: transparent;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
}
.btn-reset {
  background: none;
  border: none;
  color: var(--ink3);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  flex: 0 0 auto;
}
.btn-reset:hover { color: var(--g); }

/* Action button used in card footers */
.btn-action {
  flex: 1;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink2);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 140px;
}
.btn-action:hover {
  border-color: var(--g);
  color: var(--g);
  background: var(--g-light);
}
.btn-action svg { width: 14px; height: 14px; }
@media (max-width: 460px) {
  .btn-action { min-width: 0; font-size: 12px; padding: 9px 10px; }
}

/* ── METRICS ────────────────────────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.metric {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  transition: all 0.25s;
}
.metric.ok   { border-color: rgba(26,107,66,0.3); background: var(--g-soft); }
.metric.warn { border-color: rgba(217,123,42,0.35); background: var(--orange-soft); }
.metric.bad  { border-color: rgba(192,57,43,0.3); background: var(--red-soft); }
.metric-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink3);
  transition: color 0.25s;
}
.metric.ok   .metric-val { color: var(--g); }
.metric.warn .metric-val { color: var(--orange); }
.metric.bad  .metric-val { color: var(--red); }
.metric-label {
  font-size: 10px;
  color: var(--ink3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 5px;
}
.metric-sub {
  font-size: 11px;
  color: var(--ink3);
  margin-top: 3px;
  font-weight: 500;
}

/* ── VERDICT ────────────────────────────────────────────────────────────── */
.verdict {
  margin-top: 20px;
  border-radius: 12px;
  padding: 22px 24px;
  border: 1.5px solid;
  display: none;
  animation: fadeUp 0.35s ease both;
}
.verdict.show { display: block; }
.verdict.pass { background: #edf7f2; border-color: rgba(26,107,66,0.35); }
.verdict.ext  { background: var(--orange-soft); border-color: rgba(217,123,42,0.35); }
.verdict.fail { background: var(--red-soft); border-color: rgba(192,57,43,0.28); }

.v-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 500;
}
.verdict.pass .v-badge { color: var(--g); }
.verdict.ext  .v-badge { color: var(--orange); }
.verdict.fail .v-badge { color: var(--red); }

.v-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
}
.v-action {
  font-size: 13px;
  color: var(--ink2);
  margin-top: 10px;
  line-height: 1.55;
  padding: 12px 14px;
  background: rgba(255,255,255,0.55);
  border-radius: 8px;
}
.v-action strong { font-weight: 600; color: var(--ink); }

/* ── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
  margin-top: 22px;
  padding: 22px;
  background: var(--bg);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
  color: var(--ink3);
}
.empty-state strong { color: var(--ink); font-weight: 700; }

/* ── BADGE / PILL ───────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}
.pill-green { background: var(--g-light); border-color: rgba(26,107,66,0.2); color: var(--g); }
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g-mid);
}

/* ── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,28,20,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-overlay.active { display: flex; }
.modal-box {
  width: min(520px, 100%);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  animation: fadeUp 0.25s ease both;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}
.modal-title {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}
.modal-hint {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 4px;
  line-height: 1.4;
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}
.modal-close:hover {
  border-color: var(--g);
  color: var(--g);
}
.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.modal-btns .btn { flex: 1; padding: 12px 16px; font-size: 14px; }

/* Inline error message inside forms / modals */
.err {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  border: 1px solid rgba(192,57,43,0.18);
  color: var(--red);
  font-weight: 600;
  font-size: 13px;
}
.err.show { display: block; }

/* ── TOAST ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--white);
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── DASHBOARD ──────────────────────────────────────────────────────────── */
.toolbar {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: 0.18s;
}
.search:focus-within {
  border-color: var(--g);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,107,66,0.08);
}
.search-icon { color: var(--ink3); font-size: 14px; user-select: none; }
.search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--ink);
  padding: 0;
}
.search input:focus { box-shadow: none; }

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}

.tool-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px;
  transition: 0.22s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  position: relative;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(26,107,66,0.35);
}
.tool-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.tool-left {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}
.tool-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--g-light);
  border: 1px solid rgba(26,107,66,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex: 0 0 auto;
}
.tool-meta { min-width: 0; flex: 1; }
.tool-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tool-desc {
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.tool-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.tool-file {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink3);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 6px;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-actions { display: flex; gap: 6px; }
.tool-card .inline-actions {
  display: none;
  gap: 6px;
}
.tool-card:hover .inline-actions { display: flex; }
@media (hover: none) {
  .tool-card .inline-actions { display: flex; }
}
.danger {
  color: var(--red) !important;
  border-color: rgba(192,57,43,0.25) !important;
}
.danger:hover {
  background: var(--red-soft) !important;
  border-color: var(--red) !important;
}

/* ── ANIMATIONS ─────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
