/* ══════════════════════════════════════════
   CARPINTERÍA 360 – Base & Reset
   ══════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── App shell (móvil primero) ── */
#app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ── Scroll areas ── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ── Screens ── */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  animation: fadeIn .18s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: 1.5px; line-height: 1.05; }
p { line-height: 1.6; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }

/* ── Utility ── */
.text-orange  { color: var(--orange); }
.text-muted   { color: var(--muted); }
.text-center  { text-align: center; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-8         { margin-top: 8px; }
.mt-12        { margin-top: 12px; }
.mt-16        { margin-top: 16px; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.fs-sm        { font-size: .8rem; }
.fs-xs        { font-size: .72rem; }

/* ── Desktop frame ── */
@media (min-width: 480px) {
  body { background: #111; }
  #app-shell {
    border-left:  1px solid #2A2A2A;
    border-right: 1px solid #2A2A2A;
    box-shadow: 0 0 60px rgba(0,0,0,.5);
  }
}

/* ── Header ERP ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: var(--dark);
  flex-shrink: 0;
}
.header-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #fff;
}
.header-brand span { color: var(--orange); }
.header-brand-img {
  display: block;
  height: 22px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  background: #000;
  border-radius: 4px;
  padding: 2px 5px;
}
.header-tagline {
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
}
.header-actions { display: flex; gap: 6px; }
.header-icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; border: none;
  position: relative;
  transition: background .15s;
}
.header-icon-btn:active { background: rgba(255,255,255,.18); }

/* ── Page header (interior screens) ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.page-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 1.5px;
  flex: 1;
}
.page-header-actions { margin-left: auto; }
.back-btn {
  font-size: 1.2rem;
  color: var(--orange);
  padding: 4px;
  cursor: pointer;
  font-weight: 700;
  border: none;
  background: none;
}

/* ── Bottom Nav ── */
.bottom-nav {
  display: grid;
  background: var(--card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 2px 5px;
  font-size: .45rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: color .15s;
  gap: 2px;
  font-family: var(--font-body);
}
.nav-item.active { color: var(--orange); }
.nav-icon { font-size: 1.15rem; line-height: 1; }

/* ── Form global ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.form-group label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .88rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--orange); }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Btn global ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 13px;
  border-radius: var(--r-sm);
  font-size: .88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  font-family: var(--font-body);
  letter-spacing: .3px;
}
.btn:active { transform: scale(.97); filter: brightness(.9); }
