* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Arial, sans-serif;
  background: #e8e8e8;
  color: #1a1a1a;
  font-size: 14px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  height: 480px;
  background-image: url('/static/wp-logo-bg.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

/* HEADER */
header {
  background: #1a1a1a;
  color: #fff;
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 100;
  border-bottom: 1px solid #333;
}
.header-inner { display: flex; align-items: center; gap: 12px; }
.header-logo { height: 36px; width: auto; display: block; flex-shrink: 0; }
.header-wp { font-size: 16px; font-weight: bold; letter-spacing: 0.5px; color: #fff; }
.header-sub { font-size: 12px; color: #888; }
.btn-new {
  background: #22c55e;
  color: #000;
  border: none;
  border-radius: 5px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.btn-new:hover { background: #16a34a; }
.btn-refresh {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.btn-refresh:hover { color: #fff; border-color: #888; }
.btn-menu { display: none; background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 4px 8px; }
.btn-close-sidebar { background: none; border: none; color: #888; font-size: 16px; cursor: pointer; padding: 0; }
.sidebar-overlay { display: none; }

/* LAYOUT */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: #dcdcdc;
  border-right: 1px solid #c8c8c8;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-hdr {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  padding: 12px 16px 8px;
  border-bottom: 1px solid #c8c8c8;
  position: sticky;
  top: 0;
  background: #dcdcdc;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.proj-item {
  padding: 12px 16px;
  border-bottom: 1px solid #c8c8c8;
  cursor: pointer;
  transition: background 0.1s;
}
.proj-item:hover { background: #d0d0d0; }
.proj-item.active { background: #e8e8e8; border-left: 3px solid #22c55e; }
.proj-name { font-size: 13px; font-weight: bold; color: #1a1a1a; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-addr { font-size: 11px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.proj-meta { font-size: 11px; color: #888; }

/* MAIN */
main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* EMPTY STATE */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #888;
}
.empty-icon { font-size: 48px; }
.empty-text { font-size: 15px; }

/* CARD */
.card {
  background: #f4f4f4;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  padding: 20px;
}
.card h2 {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #555;
  margin-bottom: 16px;
}

/* GRID */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.col-2 { grid-column: span 2; }

/* FIELDS */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11px;
  color: #555;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.field input,
.field textarea,
.field select {
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  color: #1a1a1a;
  background: #ffffff;
}
.field input:focus,
.field textarea:focus { outline: none; border-color: #22c55e; background: #f8fff8; }
.field textarea { resize: vertical; }

/* SAVE BTN */
.btn-save {
  margin-top: 14px;
  background: #22c55e;
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.btn-save:hover { background: #16a34a; }

/* PHOTOS */
.photos-zone { margin-bottom: 0; }
.photos-placeholder {
  border: 2px dashed #c8c8c8;
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  color: #888;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
}
.photos-placeholder:hover { border-color: #888; color: #555; }
.photos-placeholder.hidden { display: none; }
.photos-zone.drag-over { background: #ebebeb; border-radius: 6px; outline: 2px dashed #888; outline-offset: 4px; }
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #d0d0d0;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdf-thumb {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #efefef; gap: 4px; padding: 4px;
}
.pdf-icon {
  background: #c0392b; color: #fff;
  font-size: 11px; font-weight: bold;
  padding: 2px 6px; border-radius: 3px;
}
.pdf-name {
  font-size: 9px; color: #888;
  text-align: center; word-break: break-all;
  line-height: 1.2; max-height: 32px; overflow: hidden;
}
.photo-delete {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.5);
  color: #fff; border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.btn-add-photo {
  font-size: 12px; color: #666;
  background: none; border: 1px solid #c8c8c8;
  border-radius: 4px; padding: 6px 12px;
  cursor: pointer; font-family: Arial, sans-serif; margin-top: 8px;
}
.btn-add-photo:hover { border-color: #888; color: #333; }

/* VOICE */
.voice-row { display: flex; gap: 10px; align-items: flex-start; }
.voice-row textarea { flex: 1; }
.btn-mic {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid #c8c8c8;
  background: #efefef;
  font-size: 20px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-mic:hover { border-color: #888; }
.btn-mic.recording {
  border-color: #f87171;
  background: #fee2e2;
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.voice-status { font-size: 12px; color: #f87171; margin-top: 6px; min-height: 18px; }

/* AI BUTTON */
.btn-ai {
  margin-top: 16px; width: 100%;
  background: #22c55e; color: #000;
  border: none; border-radius: 6px;
  padding: 12px; font-size: 14px; font-weight: bold;
  cursor: pointer; font-family: Arial, sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-ai:hover { background: #16a34a; }
.btn-ai:disabled { background: #c8e6c9; color: #aaa; cursor: not-allowed; }

/* POSTES */
.postes-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.postes-header h2 { margin-bottom: 0; }
.btn-add-poste {
  font-size: 12px; background: none;
  border: 1px solid #c8c8c8; border-radius: 4px;
  padding: 6px 12px; cursor: pointer; color: #666;
  font-family: Arial, sans-serif;
}
.btn-add-poste:hover { border-color: #888; color: #1a1a1a; }
.empty-postes { text-align: center; color: #888; font-size: 13px; padding: 20px 0; }

/* POSTE ITEM */
.poste-item {
  border: 1px solid #d4d4d4;
  border-radius: 6px; margin-bottom: 12px; overflow: hidden;
}
.poste-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #ebebeb; border-bottom: 1px solid #d4d4d4;
}
.poste-num { font-size: 12px; font-weight: bold; color: #888; width: 20px; flex-shrink: 0; }
.poste-title-input {
  flex: 1; border: none; background: transparent;
  font-size: 13px; font-weight: bold; font-family: Arial, sans-serif;
  color: #1a1a1a; padding: 0;
}
.poste-title-input:focus { outline: none; }
.poste-cfc-select {
  width: 180px; border: none;
  background: #e0e0e0; border-radius: 4px;
  font-size: 11px; font-family: Arial, sans-serif;
  color: #666; padding: 2px 6px;
  flex-shrink: 0; cursor: pointer;
}
.poste-cfc-select:focus { outline: none; background: #d4d4d4; color: #333; }
.poste-actions { display: flex; gap: 6px; }
.btn-poste-del { background: none; border: none; color: #bbb; cursor: pointer; font-size: 16px; padding: 0 4px; }
.btn-poste-del:hover { color: #f87171; }
.btn-poste-move { background: none; border: none; color: #bbb; cursor: pointer; font-size: 14px; padding: 0 2px; }
.btn-poste-move:hover { color: #555; }
.poste-body { padding: 12px 14px; background: #f8f8f8; }
.poste-desc-input {
  width: 100%; border: none; background: transparent;
  font-size: 13px; font-family: Arial, sans-serif;
  color: #555; resize: none; line-height: 1.6; min-height: 80px;
}
.poste-desc-input:focus { outline: none; color: #1a1a1a; }

/* ACTIONS CARD */
.actions-card { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.btn-generate {
  flex: 1; background: #22c55e; color: #000;
  border: none; border-radius: 6px; padding: 14px;
  font-size: 15px; font-weight: bold; cursor: pointer;
  font-family: Arial, sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 200px;
}
.btn-generate:hover { background: #16a34a; }
.btn-generate:disabled { background: #c8e6c9; color: #aaa; cursor: not-allowed; }
.btn-danger {
  background: none; border: 1px solid #d0d0d0;
  color: #888; border-radius: 6px;
  padding: 12px 16px; font-size: 13px;
  cursor: pointer; font-family: Arial, sans-serif;
}
.btn-danger:hover { border-color: #f87171; color: #f87171; }

/* SPINNER */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* BUTTONS */
.btn-primary {
  background: #22c55e; color: #000;
  border: none; border-radius: 5px;
  padding: 10px 20px; font-size: 14px;
  font-weight: bold; cursor: pointer; font-family: Arial, sans-serif;
}
.btn-primary:hover { background: #16a34a; }
.btn-primary.large { padding: 14px 28px; font-size: 15px; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal {
  background: #f4f4f4; border: 1px solid #d0d0d0;
  border-radius: 8px; padding: 28px;
  width: 100%; max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}
.modal h3 { font-size: 16px; margin-bottom: 20px; color: #1a1a1a; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.btn-cancel {
  background: none; border: 1px solid #c8c8c8;
  color: #666; border-radius: 5px;
  padding: 8px 16px; font-size: 14px;
  cursor: pointer; font-family: Arial, sans-serif;
}
.btn-cancel:hover { border-color: #888; color: #333; }

/* MOBILE */
@media (max-width: 640px) {
  .btn-menu { display: inline-block; }
  .header-sub { display: none; }
  .sidebar {
    width: 80%; max-width: 300px;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 200; transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 199;
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }
  main { padding: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .col-2 { grid-column: span 1; }
  .actions-card { flex-direction: column; }
  .btn-generate { width: 100%; }
}
