/* =================================================
   DNG PRO — APP STYLES
   ================================================= */
:root {
  --blu:     #0B1F3A;
  --blu-mid: #132d52;
  --blu-l:   #1A3568;
  --amber:   #F59E0B;
  --amber-d: #D97706;
  --white:   #F8F7F4;
  --bg:      #F3F4F6;
  --card:    #ffffff;
  --gray:    #6B7280;
  --gray-l:  #E5E7EB;
  --text:    #1F2937;
  --green:   #10B981;
  --red:     #DC2626;
  --shadow:  0 4px 16px rgba(11,31,58,.08);
  --shadow-lg: 0 12px 40px rgba(11,31,58,.15);
  --radius:  14px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --nav-h: 60px;
  --side-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ APP SHELL ============ */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--blu);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 1.05rem;
}
.app-logo span { font-size: 1.3rem; color: var(--amber); }
.app-logo strong { font-weight: 800; letter-spacing: .02em; }

.app-burger {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.app-burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

.app-sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: var(--side-w);
  background: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 99;
  border-right: 1px solid var(--gray-l);
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  transition: var(--transition);
}
.side-link:hover { background: var(--bg); color: var(--blu); }
.side-link.active {
  background: var(--blu);
  color: #fff;
  box-shadow: 0 4px 12px rgba(11,31,58,.2);
}
.side-link.logout { color: var(--red); }
.side-link.logout:hover { background: rgba(220,38,38,.08); }
.side-sep {
  border: none;
  height: 1px;
  background: var(--gray-l);
  margin: 12px 0;
}
.app-overlay {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  background: rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  z-index: 98;
  transition: opacity var(--transition);
}
body.sidebar-open .app-sidebar { transform: none; }
body.sidebar-open .app-overlay { opacity: 1; pointer-events: auto; }

@media (min-width: 900px) {
  .app-sidebar { transform: none; }
  .app-burger { display: none; }
  .app-main { margin-left: var(--side-w); }
  .app-overlay { display: none; }
}

.app-main {
  padding-top: calc(var(--nav-h) + 24px);
  padding-bottom: 60px;
  min-height: 100vh;
}
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============ HEADERS ============ */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.page-title {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--blu);
  line-height: 1.2;
}
.page-sub {
  color: var(--gray);
  margin-top: 4px;
  font-size: .95rem;
}

/* ============ CARDS ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-l);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-head h3 {
  font-size: 1.05rem;
  color: var(--blu);
  font-weight: 700;
}
.card-empty {
  color: var(--gray);
  text-align: center;
  padding: 30px 14px;
  font-size: .92rem;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
  border: 2px solid transparent;
  transition: var(--transition);
  background: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--amber);
  color: var(--blu);
  border-color: var(--amber);
}
.btn-primary:hover { background: var(--amber-d); border-color: var(--amber-d); transform: translateY(-1px); }
.btn-blu {
  background: var(--blu);
  color: #fff;
  border-color: var(--blu);
}
.btn-blu:hover { background: var(--blu-mid); border-color: var(--blu-mid); }
.btn-ghost {
  background: transparent;
  color: var(--blu);
  border-color: var(--gray-l);
}
.btn-ghost:hover { border-color: var(--blu); background: var(--bg); }
.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 8px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: 50%;
}

/* ============ FORMS ============ */
.form-grid { display: grid; gap: 16px; }
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row-2 { grid-template-columns: 1fr; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--blu);
}
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-l);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transition: var(--transition);
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-hint {
  font-size: .78rem;
  color: var(--gray);
}

/* ============ DASHBOARD ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 800px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }
.kpi {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
  border: 1px solid var(--gray-l);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(245,158,11,.12);
  color: var(--amber-d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 6px;
}
.kpi-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--blu);
  line-height: 1;
}
.kpi-label {
  font-size: .82rem;
  color: var(--gray);
  font-weight: 600;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ============ LISTS ============ */
.app-list { display: flex; flex-direction: column; gap: 10px; }
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--gray-l);
  border-radius: 12px;
  transition: var(--transition);
}
.list-row:hover { box-shadow: var(--shadow); border-color: var(--amber); }
.row-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--blu);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  flex-shrink: 0;
}
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-weight: 700;
  color: var(--blu);
  font-size: .98rem;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  font-size: .82rem;
  color: var(--gray);
}
.row-meta {
  text-align: right;
  font-size: .78rem;
  color: var(--gray);
  flex-shrink: 0;
}
.row-meta strong {
  display: block;
  color: var(--blu);
  font-size: .9rem;
}
.row-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--gray-l);
  background: #fff;
  color: var(--gray);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.icon-btn:hover { color: var(--blu); border-color: var(--blu); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }

/* ============ SEARCH BAR ============ */
.search-bar {
  position: relative;
  margin-bottom: 18px;
}
.search-bar input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--gray-l);
  border-radius: 10px;
  font-size: .95rem;
  background: #fff;
}
.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: .5;
}

/* ============ FAB (Floating Action Button) ============ */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--blu);
  border: none;
  font-size: 1.8rem;
  font-weight: 300;
  box-shadow: 0 8px 24px rgba(245,158,11,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: var(--transition);
}
.fab:hover { transform: scale(1.08); box-shadow: 0 10px 32px rgba(245,158,11,.55); }

/* ============ MODAL ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(11,31,58,.6);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal.open { display: flex; }
.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .3s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-head h3 {
  font-size: 1.2rem;
  color: var(--blu);
  font-weight: 800;
}
.modal-close {
  background: var(--bg);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--gray);
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ============ LOGIN ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0B1F3A 0%, #1A3568 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 44px 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  text-align: center;
}
.login-logo {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: var(--blu);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: var(--amber);
  font-size: 2.4rem;
}
.login-title {
  font-size: 1.4rem;
  color: var(--blu);
  font-weight: 800;
  margin-bottom: 6px;
}
.login-sub {
  color: var(--gray);
  font-size: .9rem;
  margin-bottom: 26px;
}
.login-card .field { text-align: left; margin-bottom: 16px; }

/* ============ INTERVENTO — CAMERA + FIRMA ============ */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.foto-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--gray-l);
}
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.foto-thumb .foto-del {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,.7);
  color: #fff;
  border: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.foto-add {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 2px dashed var(--gray-l);
  border-radius: 8px;
  aspect-ratio: 1;
  color: var(--gray);
  font-size: 2rem;
  cursor: pointer;
  transition: var(--transition);
}
.foto-add:hover { border-color: var(--amber); color: var(--amber); background: rgba(245,158,11,.05); }
.foto-add input { display: none; }

.firma-wrap {
  border: 2px dashed var(--gray-l);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  margin-top: 10px;
}
.firma-canvas {
  width: 100%;
  height: 200px;
  background: #fff;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}
.firma-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--blu);
  color: #fff;
  padding: 14px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: .92rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  opacity: 0;
  transition: var(--transition);
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

/* ============ BADGE ============ */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-amber { background: rgba(245,158,11,.15); color: var(--amber-d); }
.badge-blu   { background: rgba(11,31,58,.1);    color: var(--blu); }
.badge-green { background: rgba(16,185,129,.15); color: #047857; }
.badge-gray  { background: var(--gray-l);        color: var(--gray); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state h3 {
  color: var(--blu);
  margin: 12px 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  opacity: .4;
}
.empty-state p {
  font-size: .92rem;
  margin-bottom: 18px;
}

/* ============ DETAIL CLIENTE ============ */
.cliente-head {
  background: linear-gradient(135deg, #0B1F3A 0%, #1A3568 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  display: flex;
  gap: 20px;
  align-items: center;
}
.cliente-head .row-avatar {
  width: 72px; height: 72px;
  font-size: 1.4rem;
  background: var(--amber);
  color: var(--blu);
}
.cliente-head h2 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.cliente-head p {
  opacity: .8;
  font-size: .9rem;
}
.cliente-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .cliente-head { flex-direction: column; text-align: center; }
  .cliente-actions { margin: 0 auto; }
}

/* ============ APPOINTMENT CARD ============ */
.appt-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  border-left: 4px solid var(--amber);
  margin-bottom: 8px;
}
.appt-time {
  text-align: center;
  min-width: 60px;
  padding-right: 14px;
  border-right: 1px solid var(--gray-l);
}
.appt-time strong {
  display: block;
  font-size: 1.2rem;
  color: var(--blu);
  font-weight: 800;
  line-height: 1;
}
.appt-time span {
  font-size: .72rem;
  color: var(--gray);
  text-transform: uppercase;
  font-weight: 700;
}
.appt-info { flex: 1; }
.appt-info strong { color: var(--blu); display: block; }
.appt-info span { color: var(--gray); font-size: .85rem; }

/* ============ INSTALL BANNER ============ */
.install-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: var(--blu);
  color: #fff;
  border-radius: 14px;
  padding: 16px 20px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 36px rgba(0,0,0,.3);
  z-index: 200;
  animation: slideUp .4s ease;
  max-width: 480px;
  margin: 0 auto;
}
.install-banner.show { display: flex; }
@keyframes slideUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.install-banner span { flex: 1; font-size: .9rem; }
.install-banner button {
  background: var(--amber);
  color: var(--blu);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .85rem;
}
.install-banner .ib-close {
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 1.2rem;
  padding: 0 6px;
}
