/* ============================================
   EVOLIA · Proposals · v1
   Editorial-corporate-tech minimalism
   tomado de WALLSWEB y adaptado a herramienta de gestión
   ============================================ */
:root {
  --paper: #f3f1ea;
  --paper-2: #ebe8de;
  --paper-3: #dfdcd0;
  --ink: #0a0a0c;
  --ink-2: #16161a;
  --electric: #1b17ff;
  --electric-2: #4a47ff;
  --electric-soft: rgba(27, 23, 255, 0.08);
  --muted: rgba(10, 10, 12, 0.55);
  --muted-2: rgba(10, 10, 12, 0.35);
  --line: rgba(10, 10, 12, 0.12);
  --line-strong: rgba(10, 10, 12, 0.22);
  --success: #1ace7c;
  --danger: #dc2626;
  --warning: #d97706;

  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-serif: 'Instrument Serif', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(10,10,12,0.04);
  --shadow: 0 4px 24px rgba(10,10,12,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--electric); color: var(--paper); }

/* paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 220'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.07;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: multiply;
}

/* ============================================
   Typography
   ============================================ */
.mono {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; }
h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; }
.serif { font-family: var(--font-serif); font-style: italic; }

/* ============================================
   Layout shell — sidebar + main
   ============================================ */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--paper);
  padding: 1.5rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.625rem;
  margin-bottom: 2.5rem;
}
.sidebar-brand svg { height: 1.6rem; }
.sidebar-brand-sub {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.15rem;
}
.nav-section {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 1.25rem 0 0.5rem;
  padding-left: 0.5rem;
}
.nav a {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  color: var(--ink);
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav a:hover { background: var(--paper-2); }
.nav a.active {
  background: var(--electric-soft);
  color: var(--electric);
  font-weight: 500;
}
.nav a.active::before {
  content: '';
  position: absolute; left: -1.25rem; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--electric);
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
}
.sidebar-foot a:hover { color: var(--electric); }

.main {
  padding: 2rem 2.5rem 4rem;
  max-width: 1400px;
}

/* page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
}
.page-head .titles .eyebrow { display: block; margin-bottom: 0.4rem; }
.page-head h1 .num { font-family: var(--font-mono); font-size: 0.75em; color: var(--muted); margin-left: 0.5rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.8125rem;
  border-radius: var(--radius);
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--electric); border-color: var(--electric); }
.btn-electric {
  background: var(--electric);
  color: var(--paper);
  border-color: var(--electric);
}
.btn-electric:hover { background: var(--electric-2); border-color: var(--electric-2); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--paper-2); border-color: var(--line); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--paper); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { padding: 0.4rem; }

/* ============================================
   Cards / panels
   ============================================ */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.panel-head h2 { font-size: 0.9375rem; font-weight: 500; }
.panel-body { padding: 1.25rem; }
.panel-body.compact { padding: 0; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.kpi-value {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  line-height: 1;
  font-style: italic;
  letter-spacing: -0.01em;
}
.kpi-sub {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}
.kpi.electric { border-color: var(--electric); background: var(--electric-soft); }
.kpi.electric .kpi-value { color: var(--electric); }

/* ============================================
   Tables
   ============================================ */
.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
table.t th, table.t td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.t th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  background: var(--paper-2);
}
table.t tbody tr:hover { background: var(--paper-2); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
table.t .nowrap { white-space: nowrap; }
table.t .voided td { opacity: 0.55; text-decoration: line-through; }
table.t .voided td .badge { text-decoration: none; }

/* ============================================
   Badges
   ============================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 99px;
  white-space: nowrap;
}

/* ============================================
   Forms
   ============================================ */
.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-row.span-2 { grid-column: span 2; }
.form-row.span-full { grid-column: 1 / -1; }
.form-row label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.input, select.input, textarea.input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--electric);
  box-shadow: 0 0 0 3px rgba(27, 23, 255, 0.12);
}
.input.num { font-family: var(--font-mono); text-align: right; }
.help {
  font-size: 0.75rem;
  color: var(--muted);
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.25rem; }
fieldset legend {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.5rem;
}

/* ============================================
   Filter bar
   ============================================ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.filter-bar .input { flex: 1 1 200px; min-width: 0; }
.filter-bar select.input { flex: 0 0 auto; min-width: 140px; }

/* ============================================
   Flash messages
   ============================================ */
.flashes {
  position: fixed; top: 1rem; right: 1rem;
  z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem;
  max-width: 360px;
}
.flash {
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--electric);
}
.flash.error { border-left-color: var(--danger); }
.flash.success { border-left-color: var(--success); }

/* ============================================
   Empty state
   ============================================ */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty .serif {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

/* ============================================
   Login centered
   ============================================ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 2;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand svg { height: 2rem; margin: 0 auto 0.5rem; }
.login-brand-sub {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.login-card h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ============================================
   Quote/Invoice line editor (alpine)
   ============================================ */
.line-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
}
.le-head, .le-row {
  display: grid;
  grid-template-columns: 30px 1fr 80px 110px 80px 110px 38px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 0.85rem;
  font-size: 0.8125rem;
}
.le-head {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.le-row {
  border-bottom: 1px solid var(--line);
}
.le-row:last-child { border-bottom: 0; }
.le-row .input { padding: 0.4rem 0.55rem; font-size: 0.8125rem; }
.le-row .desc-row { grid-column: 2 / span 5; padding-top: 0.25rem; }
.le-row .position {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

/* totals box */
.totals-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  align-items: start;
}
.totals-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.totals-box .row {
  display: flex; justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.totals-box .row.total {
  margin-top: 0.5rem; padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
  font-weight: 500;
}
.totals-box .row.total span:last-child {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
}

/* ============================================
   Public quote view
   ============================================ */
.public-doc {
  max-width: 880px;
  margin: 2rem auto;
  padding: 2.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 2;
}

/* ============================================
   Detail header
   ============================================ */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.detail-meta .item .lbl {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.detail-meta .item .val {
  font-size: 0.9375rem;
}

/* responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 1rem; }
  .totals-grid { grid-template-columns: 1fr; }
  .le-head, .le-row { grid-template-columns: 1fr; }
  .le-head { display: none; }
  .le-row { display: flex; flex-direction: column; gap: 0.35rem; }
}
