/* Reset WP styles that leak through */
#pcrm-app * { box-sizing: border-box; }
#pcrm-app a { text-decoration: none; }
body.page-template-default { background: #f5f5f3; }

/* ── Layout ───────────────────────────────────────────────── */
#pcrm-app {
  display: flex;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1a1a1a;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.pcrm-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img.site-logo { max-height: 36px; width: auto; filter: brightness(0) invert(1); }
.sidebar-logo .site-name-text { color: #fff; font-size: 16px; font-weight: 600; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 1.25rem;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.1); color: #fff; }
.nav-icon { font-size: 8px; opacity: 0.6; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.logout-btn { color: rgba(255,255,255,0.4); font-size: 16px; transition: color .15s; }
.logout-btn:hover { color: #fff; }

/* ── Main area ────────────────────────────────────────────── */
.pcrm-main {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  background: #f5f5f3;
}

.pcrm-view { display: none; padding: 2rem; }
.pcrm-view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.view-header h1 { font-size: 20px; font-weight: 600; color: #1a1a1a; }

/* ── Metric cards ─────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: #fff;
  border: 1px solid #e8e8e4;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.metric-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.metric-value { font-size: 26px; font-weight: 600; color: #1a1a1a; }
.metric-sub { font-size: 12px; color: #aaa; margin-top: 2px; }

/* ── Cards / lists ────────────────────────────────────────── */
.content-card {
  background: #fff;
  border: 1px solid #e8e8e4;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.content-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0f0ec;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Table ────────────────────────────────────────────────── */
.pcrm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pcrm-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #f0f0ec;
}
.pcrm-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f3;
  color: #1a1a1a;
  vertical-align: middle;
}
.pcrm-table tr:last-child td { border-bottom: none; }
.pcrm-table tr:hover td { background: #fafaf8; }

/* ── Status badges ────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-pending  { background: #fff7e6; color: #8a5c00; }
.badge-active   { background: #e6f7ee; color: #1a7a40; }
.badge-sstc     { background: #e6f0ff; color: #1a4fa0; }
.badge-sold     { background: #f0f0f0; color: #666; }
.badge-new      { background: #e6f0ff; color: #1a4fa0; }
.badge-viewing  { background: #e6f7ee; color: #1a7a40; }
.badge-offer    { background: #fff7e6; color: #8a5c00; }
.badge-cold     { background: #f5f5f3; color: #888; }
.badge-offer-stage  { background: #fff7e6; color: #8a5c00; }
.badge-exchange { background: #e6f7ee; color: #1a7a40; }
.badge-completion { background: #f0f0f0; color: #666; }
.badge-fallen   { background: #fee; color: #a00; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  padding: 9px 18px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-secondary {
  padding: 7px 14px;
  background: transparent;
  color: #1a1a1a;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: #f5f5f3; }

/* ── Forms ────────────────────────────────────────────────── */
.pcrm-form { max-width: 720px; }
.form-section { background: #fff; border: 1px solid #e8e8e4; border-radius: 10px; padding: 1.5rem; margin-bottom: 1.25rem; }
.form-section h2 { font-size: 15px; font-weight: 600; margin-bottom: 1.25rem; color: #1a1a1a; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 13px; font-weight: 500; color: #444; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #1a1a1a;
  outline: none;
  transition: border-color .15s;
  background: #fff;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #1a1a1a; }
.field textarea { resize: vertical; line-height: 1.5; }
.field-grid.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.optional { font-weight: 400; color: #aaa; font-size: 11px; margin-left: 4px; }
.field-hint { font-size: 12px; color: #888; margin-bottom: 0.75rem; margin-top: -0.5rem; }

/* ── Upload area ──────────────────────────────────────────── */
.upload-area { border: 2px dashed #ddd; border-radius: 10px; overflow: hidden; }
.upload-placeholder {
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  color: #888;
  transition: background .15s;
  font-size: 13px;
}
.upload-placeholder:hover { background: #fafaf8; }
.upload-icon { font-size: 24px; margin-bottom: 0.5rem; color: #bbb; }
.upload-hint { font-size: 12px; color: #aaa; margin-top: 4px; }
.photo-previews { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.photo-preview { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid #eee; }

/* ── Form actions ─────────────────────────────────────────── */
.form-actions { padding: 0.5rem 0; }
.submit-note { font-size: 12px; color: #aaa; margin-top: 0.75rem; }
.success-msg { background: #e6f7ee; border: 1px solid #a0dbb8; border-radius: 8px; padding: 10px 14px; color: #1a7a40; font-size: 13px; margin-bottom: 1rem; }
.error-msg { background: #fee; border: 1px solid #fcc; border-radius: 8px; padding: 10px 14px; color: #a00; font-size: 13px; margin-bottom: 1rem; }

/* ── Loading ──────────────────────────────────────────────── */
.loading { padding: 2rem; text-align: center; color: #aaa; font-size: 13px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .pcrm-sidebar { width: 100%; height: 56px; flex-direction: row; position: fixed; bottom: 0; top: auto; }
  .sidebar-logo, .sidebar-user { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0; overflow-x: auto; }
  .pcrm-main { margin-left: 0; margin-bottom: 56px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .field-grid.two-col { grid-template-columns: 1fr; }
}
