* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #000000;
  color: #FFFFFF;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ========== APP SHELL ========== */
.app-header {
  text-align: left;
  padding: 24px 16px 16px;
}
.app-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.app-header p {
  font-size: 15px;
  color: #8A8A93;
  font-weight: 500;
  margin-top: 4px;
}

/* ========== LOADING ========== */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  gap: 12px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(56,189,248,0.15);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { font-size: 14px; color: #94a3b8; }

/* ========== CARD ========== */
.card {
  background: #09090B;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #8A8A93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

/* ========== SEARCH ========== */


/* ========== ORDER ITEM ========== */
.order-item {
  display: flex;
  align-items: center;
  background: #121214;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 22px;
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.order-item:active { transform: scale(0.98); }
.order-item.selected {
  background: #1A1A1F;
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}
.item-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-right: 14px;
  flex-shrink: 0;
}
.item-icon.wix { background: rgba(56, 189, 248, 0.1); color: #38BDF8; }
.item-icon.manual { background: rgba(16, 185, 129, 0.1); color: #10B981; }
.order-item .info { flex: 1; min-width: 0; }
.order-item .name {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.order-item .sub {
  font-size: 13px;
  color: #8A8A93;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.date-badge {
  display: inline-block;
  font-size: 11px;
  color: #38bdf8;
  background: rgba(56,189,248,0.1);
  padding: 2px 8px;
  border-radius: 8px;
  margin-top: 4px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 4px;
  flex-shrink: 0;
}
.badge-preparacion { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-terminado { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-transito { background: rgba(56,189,248,0.15); color: #38bdf8; }
.badge-cancelado { background: rgba(239,68,68,0.15); color: #ef4444; }

/* ========== BUTTONS ========== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: 100px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.4; transform: none; }
.btn-primary {
  background: #38BDF8;
  color: #000000;
  box-shadow: 0 4px 20px rgba(56,189,248,0.3);
}
.btn-success {
  background: #10B981;
  color: #000000;
  box-shadow: 0 4px 20px rgba(16,185,129,0.3);
}
.btn-secondary {
  background: #1A1A1F;
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.05);
}
.btn-outline {
  background: transparent;
  color: #8A8A93;
  border: 1px solid rgba(255,255,255,0.1);
}

/* ========== TAB BUTTONS ========== */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(148,163,184,0.1);
  background: rgba(2,6,12,0.5);
  color: #94a3b8;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: rgba(56,189,248,0.1);
  border-color: #38bdf8;
  color: #38bdf8;
}
.tab-btn:disabled { opacity: 0.4; cursor: default; }
.tab-btn .check { color: #10b981; margin-left: 4px; }

/* ========== CAMERA ========== */
#camera-section {
  margin-bottom: 12px;
}
#camera-wrapper {
  border: 2px dashed rgba(148,163,184,0.2);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #000;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#camera-wrapper video,
#camera-wrapper img {
  width: 100%;
  display: block;
}
#camera-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
#camera-controls .btn { flex: 1; padding: 12px; font-size: 14px; }

/* ========== FORM ========== */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.search-box,
#month-filter {
  width: 100%;
  padding: 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.05);
  background: #121214;
  color: #FFFFFF;
  font-size: 16px;
  outline: none;
  transition: all 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-group input::placeholder,
.search-box::placeholder {
  color: #8A8A93;
}
#month-filter {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238A8A93' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 36px;
}
.form-group input:focus,
.form-group select:focus,
.search-box:focus,
#month-filter:focus {
  border-color: #38BDF8;
  background: #1A1A1F;
}
.form-group select option,
#month-filter option { background: #000000; color: #FFFFFF; }

/* ========== STATUS / TOAST ========== */
#toast {
  position: fixed;
  bottom: 20px;
  left: 12px;
  right: 12px;
  max-width: 456px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.2); color: #34d399; }
#toast.error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.2); color: #f87171; }
#toast.info { background: rgba(56,189,248,0.15); border: 1px solid rgba(56,189,248,0.2); color: #38bdf8; }

/* ========== AUTH SCREEN ========== */
#auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}
#auth-screen h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
#auth-screen p {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
  text-align: center;
}
#auth-screen .search-box { margin-bottom: 12px; }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #475569;
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ========== OCR RESULT ========== */
.ocr-result {
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.12);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: #34d399;
  margin-bottom: 12px;
}
.ocr-error {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.12);
  color: #f87171;
}

/* ========== DETAIL OVERLAY (full screen) ========== */
#detail-section {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000000;
  display: flex;
  flex-direction: column;
}
#detail-section.hidden { display: none; }
#detail-overlay {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
#detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: #09090B;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  flex-shrink: 0;
}
.btn-back {
  background: #1A1A1F;
  border: 1px solid rgba(255,255,255,0.05);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.btn-back:active { transform: scale(0.95); }
#detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 90px 16px;
}

/* ========== VIEW SYSTEM ========== */
.view-content {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px;
  padding-bottom: 60px;
}

/* ========== BOTTOM NAV ========== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.03);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  transition: color 0.2s;
}
.nav-btn.active {
  color: #38bdf8;
}
.nav-btn .nav-icon {
  font-size: 20px;
  line-height: 1;
}
.nav-btn .nav-label {
  font-size: 11px;
  font-weight: 500;
}
#app-main {
  padding-bottom: 0;
}

/* ========== PHOTO GALLERY ========== */
.photo-gallery {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.photo-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* ========== RADIO PILL ========== */
.radio-pill { transition: all 0.2s; }
.radio-pill:active { transform: scale(0.97); }

/* ========== TIMELINE ========== */
.timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 8px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  position: relative;
}
.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(148,163,184,0.2);
  background: rgba(2,6,12,0.5);
  color: #64748b;
  transition: all 0.3s;
  z-index: 1;
}
.timeline-dot.completed {
  background: rgba(16,185,129,0.15);
  border-color: #10b981;
  color: #34d399;
}
.timeline-dot.active {
  background: rgba(56,189,248,0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56,189,248,0.3);
}
.timeline-dot.cancelled {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
  color: #ef4444;
}
.timeline-line {
  flex: 1;
  height: 2px;
  background: rgba(148,163,184,0.12);
  margin: 0 -1px;
  align-self: center;
  margin-bottom: 24px;
  min-width: 8px;
}
.timeline-line.completed {
  background: #10b981;
}
.timeline-label {
  font-size: 9px;
  color: #64748b;
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.timeline-label.completed {
  color: #34d399;
}
.timeline-label.active {
  color: #38bdf8;
  font-weight: 600;
}
.timeline-date {
  font-size: 8px;
  color: #475569;
  text-align: center;
  margin-top: 1px;
  line-height: 1.1;
}

#desktop-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #000000;
  color: #FFFFFF;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
