/* ============================================================
   MNET Reparaciones - Design System
   Paleta: Navy oscuro + Cyan vibrante
   Tipografia: Sora (display) + Manrope (body)
   ============================================================ */

:root {
  --ink: #0b1220;
  --ink-2: #1e293b;
  --ink-3: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --brand: #06b6d4;
  --brand-dark: #0891b2;
  --brand-light: #22d3ee;
  --brand-bg: #ecfeff;
  --blue-deep: #1e40af;

  --bg: #f8fafc;
  --bg-2: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-2: #cbd5e1;

  --success: #10b981;
  --success-bg: #d1fae5;
  --success-ink: #065f46;
  --warn: #f59e0b;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-ink: #991b1b;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --info-ink: #1e40af;
  --purple: #8b5cf6;
  --purple-bg: #ede9fe;
  --purple-ink: #5b21b6;
  --wa: #25d366;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 20px 40px -10px rgba(15, 23, 42, 0.18);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Sora', 'Manrope', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; margin-bottom: 8px; }
a { color: var(--brand-dark); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Layout admin: sidebar + main */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--ink);
  color: #cbd5e1;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 0 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}
.sidebar-brand .logo {
  display: flex; align-items: center; gap: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.sidebar-brand .logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--blue-deep) 100%);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}
.sidebar-brand .tagline {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.sidebar-nav {
  flex: 1;
  padding: 0 12px;
  list-style: none;
  margin: 0;
}
.sidebar-nav .section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding: 16px 14px 8px;
  font-weight: 600;
}
.sidebar-nav button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav button:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}
.sidebar-nav button.active {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.15), transparent);
  color: #fff;
  border-left: 3px solid var(--brand);
  padding-left: 11px;
}
.sidebar-nav .icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}
.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.sidebar-user .name { color: #fff; font-weight: 600; }
.sidebar-user .email { color: var(--muted-2); font-size: 12px; margin-bottom: 10px; word-break: break-all; }

.main { background: var(--bg); min-width: 0; }
.topbar {
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.85);
}
.topbar h2 { margin: 0; font-size: 20px; }
.topbar .search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar .search-wrap input {
  padding-left: 40px;
  background: var(--bg-2);
  border-color: transparent;
}
.topbar .search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); width: 16px; height: 16px;
}
.content { padding: 28px 32px 60px; max-width: 1400px; }

/* Layouts publicos (login, tracking) */
.public-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #0b1220 0%, #1e293b 100%);
  position: relative;
}
.public-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(6, 182, 212, 0.15), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(30, 64, 175, 0.2), transparent 40%);
  pointer-events: none;
}
.public-navbar {
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative; z-index: 2;
}
.public-navbar .logo {
  display: flex; align-items: center; gap: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.public-navbar .logo-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--blue-deep) 100%);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}
.public-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 60px;
  position: relative; z-index: 2;
}
.public-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 460px;
  padding: 40px;
}
.public-card h1 { margin-bottom: 4px; }
.public-card .subtitle { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.public-footer {
  padding: 20px 40px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  position: relative; z-index: 2;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.card-header h2, .card-header h3 { margin: 0; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--blue-deep));
}
.stat-card.accent-success::before { background: linear-gradient(90deg, var(--success), #059669); }
.stat-card.accent-warn::before { background: linear-gradient(90deg, var(--warn), #d97706); }
.stat-card.accent-purple::before { background: linear-gradient(90deg, var(--purple), #7c3aed); }
.stat-card .icon-wrap {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-bg); color: var(--brand-dark);
  margin-bottom: 14px;
}
.stat-card.accent-success .icon-wrap { background: var(--success-bg); color: var(--success-ink); }
.stat-card.accent-warn .icon-wrap { background: var(--warn-bg); color: var(--warn-ink); }
.stat-card.accent-purple .icon-wrap { background: var(--purple-bg); color: var(--purple-ink); }
.stat-card .label {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  font-weight: 600; margin-bottom: 4px;
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  color: var(--ink); line-height: 1.1;
}
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Forms */
label {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 6px;
  margin-top: 14px;
  font-weight: 500;
}
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
input[disabled] { background: var(--bg-2); color: var(--muted); cursor: not-allowed; }
textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1.2;
}
button:hover, .btn:hover { background: var(--ink-2); text-decoration: none; box-shadow: var(--shadow); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--ink); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--ink-2); border: 1px solid var(--border-2); }
.btn-outline:hover { background: var(--bg-2); color: var(--ink); }
.btn-wa { background: var(--wa); }
.btn-wa:hover { background: #1fb855; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  background: var(--bg-2);
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
tbody tr:hover td { background: var(--bg-2); }
tbody tr:last-child td { border-bottom: 0; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-recibido { background: var(--info-bg); color: var(--info-ink); }
.badge-diagnostico { background: var(--warn-bg); color: var(--warn-ink); }
.badge-presupuestado { background: var(--purple-bg); color: var(--purple-ink); }
.badge-presupuesto_aceptado { background: var(--success-bg); color: var(--success-ink); }
.badge-presupuesto_rechazado { background: var(--danger-bg); color: var(--danger-ink); }
.badge-en_reparacion { background: var(--warn-bg); color: var(--warn-ink); }
.badge-reparado { background: var(--success-bg); color: var(--success-ink); }
.badge-entregado { background: #e2e8f0; color: var(--ink-2); }
.badge-cancelado { background: var(--danger-bg); color: var(--danger-ink); }

/* Modals */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(11, 18, 32, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 700px;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal .close {
  position: absolute; top: 12px; right: 12px;
  background: transparent; color: var(--muted);
  font-size: 22px; padding: 4px 10px; line-height: 1;
}
.modal .close:hover { background: var(--bg-2); color: var(--ink); box-shadow: none; }
.modal h3 { margin-top: 0; margin-bottom: 18px; }

/* Timeline */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}
.timeline li { padding: 10px 0 10px 20px; position: relative; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -8px; top: 16px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--brand);
}
.timeline .time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .note { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.timeline .author { font-size: 11px; color: var(--muted-2); margin-top: 2px; }

/* Photos */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--bg-2);
}
.photo img { width: 100%; height: 130px; object-fit: cover; display: block; }
.photo .caption { font-size: 11px; padding: 6px 10px; color: var(--muted); background: var(--surface); }
.photo .remove {
  position: absolute; top: 6px; right: 6px;
  background: rgba(239, 68, 68, 0.95); color: #fff;
  border-radius: 6px; padding: 3px 8px;
  font-size: 11px; cursor: pointer; border: none;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 500;
}
.alert-error { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success-ink); border: 1px solid #a7f3d0; }
.alert-info { background: var(--info-bg); color: var(--info-ink); border: 1px solid #bfdbfe; }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #fde68a; }

/* Hero tracking publico */
.hero-tracker {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 44px;
}
.hero-tracker h1 { font-size: 30px; margin-bottom: 6px; }
.hero-tracker .sub { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
.hero-tracker .track-input { display: flex; gap: 10px; margin-bottom: 12px; }
.hero-tracker .track-input input {
  font-size: 16px;
  font-family: var(--font-display);
  font-weight: 600;
  padding: 14px 18px;
  letter-spacing: 0.04em;
}
.search-toggle {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: var(--bg-2); padding: 4px; border-radius: var(--radius);
  width: fit-content;
}
.search-toggle button {
  background: transparent; color: var(--muted); padding: 6px 14px;
  font-size: 13px; font-weight: 600; box-shadow: none;
}
.search-toggle button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.search-toggle button:hover { box-shadow: none; }

/* Utilities */
.flex { display: flex; gap: 10px; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.right { text-align: right; }
.center { text-align: center; }
.bold { font-weight: 700; }
.hidden { display: none !important; }
.money { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 600; }
.code-tag {
  display: inline-block;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  background: var(--bg-2); color: var(--ink-2);
  padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}

.key-value { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 13px; }
.key-value dt { color: var(--muted); font-weight: 500; }
.key-value dd { margin: 0; color: var(--ink-2); font-weight: 500; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }

.budget-box {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.budget-box::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(6,182,212,0.3), transparent 70%);
  pointer-events: none;
}
.budget-box .label {
  color: var(--brand-light); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.budget-box .amount {
  font-family: var(--font-display); font-size: 34px;
  font-weight: 700; letter-spacing: -0.02em; margin-top: 6px;
}
.budget-box .desc { margin-top: 12px; color: #cbd5e1; font-size: 14px; }

.warranty-box {
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--success-ink);
  display: flex; align-items: center; gap: 12px;
}
.warranty-box svg { flex-shrink: 0; }

/* Responsive */
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; background: var(--bg-2); color: var(--ink); border-radius: var(--radius); border: 1px solid var(--border); }
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    z-index: 50;
    transition: left 0.2s;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { left: 0; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 40px; }
  .menu-toggle { display: inline-flex; }
  .topbar h2 { font-size: 17px; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-layout { grid-template-columns: 1fr; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
