@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
  --rw-orange: #f26b1d;
  --rw-dark-1: #0b0c10;
  --rw-dark-2: #12131a;
  --rw-dark-3: #181a22;
  --rw-light: #fef5ee;
  --rw-border: #e7e7e7;
  --rw-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--rw-font);
  background: var(--rw-dark-2);
  color: rgba(255,255,255,0.9);
}

h1, h2, h3, h4 {
  margin: 0 0 6px;
  font-weight: 900;
  color: #ffffff;
}

p { margin: 0; }

.page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0b0c10 0%, #12131a 55%, #f26b1d 140%);
}

.shell {
  width: min(1200px, 94vw);
  margin: 0 auto;
  padding: 0 10px;
}

.hero {
  padding: 42px 0 30px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hero-copy h1 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; }
.hero-copy .lede { color: rgba(255,255,255,0.82); max-width: 640px; }

.logo-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.9);
  border-radius: 14px;
  padding: 8px 12px;
}
.logo-wrap {
  background: #ffffff;
  border-radius: 10px;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-wrap img { height: 34px; display: block; }
.logo-text { color: var(--rw-dark-1); font-weight: 800; letter-spacing: 0.02em; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid rgba(255,255,255,0.22);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.08);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.68);
  margin: 12px 0 6px;
  font-weight: 800;
}
.eyebrow.dark { color: var(--rw-dark-3); }

.main {
  padding: 0 0 40px;
  margin-top: -6px;
}

.container {
  width: 100%;
  padding: 0 0 12px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
}

.user-panel { display:flex; align-items:center; gap:12px; }
.user-email { font-weight: 800; color: #ffffff; }
.tag {
  display:inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--rw-light);
  color: var(--rw-orange);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(242,107,29,0.35);
}

.card {
  background: #ffffff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(17,24,39,0.06);
  margin-bottom: 16px;
  border: 1px solid var(--rw-border);
  color: var(--rw-dark-1);
}
.card h1,
.card h2,
.card h3,
.card h4 { color: var(--rw-dark-1); }
.card .eyebrow { color: var(--rw-dark-3); }
.card.inset { background: var(--rw-light); border: 1px solid var(--rw-border); box-shadow: none; }

.row { display:flex; align-items:center; justify-content:space-between; gap: 12px; }
.gap { gap: 8px; }
.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items:end; margin-top: 10px; }
.stack { display:flex; flex-direction:column; gap: 12px; }
.meta-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 12px 0 4px; }

label { display:block; font-size: 14px; color: var(--rw-dark-1); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid var(--rw-border);
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  font-family: var(--rw-font);
  color: var(--rw-dark-1);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(242,107,29,0.35);
  border-color: rgba(242,107,29,0.6);
  box-shadow: 0 0 0 2px rgba(242,107,29,0.12);
}

.check { display:flex; align-items:center; gap:10px; }
.check input { width:auto; margin:0; }

button {
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: var(--rw-orange);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  font-family: var(--rw-font);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(242,107,29,0.22); }
button:active { transform: translateY(0); box-shadow: none; }

button.ghost {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 12px;
  padding: 9px 12px;
}

button.danger {
  background: transparent;
  color: var(--rw-orange);
  border: 1px solid rgba(242,107,29,0.5);
  box-shadow: none;
}
button.danger:hover { background: rgba(242,107,29,0.08); box-shadow: none; }

button.primary { background: var(--rw-orange); color: #ffffff; }
button:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
button.small { padding: 6px 10px; font-size: 12px; border-radius: 10px; }

.card .ghost {
  color: var(--rw-dark-1);
  border-color: var(--rw-border);
}
.card .ghost:hover { background: var(--rw-light); color: var(--rw-orange); }

.tabs { display:flex; gap: 8px; margin: 14px 0; }
.tab {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--rw-border);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  color: #ffffff;
  font-weight: 800;
}
.tab.active { background: #ffffff; color: var(--rw-dark-1); border-color: var(--rw-border); }

.muted { color: rgba(24,26,34,0.72); margin: 4px 0 0; }
.msg { margin-top: 8px; font-weight: 800; color: var(--rw-orange); }
.pre {
  background: var(--rw-dark-1);
  color: rgba(255,255,255,0.9);
  padding:12px;
  border-radius:12px;
  overflow:auto;
  font-size:12px;
  min-height: 120px;
  border: 1px solid var(--rw-border);
}
.strong { font-weight: 800; }
.badge { padding:6px 10px; border-radius:999px; background: rgba(24,26,34,0.08); color: var(--rw-dark-1); font-size: 12px; border:1px solid var(--rw-border); }
.badge.danger { background: var(--rw-light); color: var(--rw-orange); border: 1px solid rgba(242,107,29,0.35); }
.modal-card { width: min(520px, 92vw); }

.list-row { display:flex; align-items:center; justify-content:space-between; padding:12px; border-bottom:1px solid var(--rw-border); cursor:pointer; }
.list-row:hover { background: var(--rw-light); }
.list-row:last-child { border-bottom:none; }
.pill { display:inline-block; padding:6px 10px; border-radius: 999px; background: #ffffff; color: var(--rw-dark-1); font-size: 12px; font-weight: 800; border: 1px solid var(--rw-border); }

.report {
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid var(--rw-border);
  padding: 14px;
  border-radius: 12px;
}
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.kv {
  background: #fff;
  border: 1px solid var(--rw-border);
  border-radius: 12px;
  padding: 12px;
}
.k {
  font-size: 12px;
  color: rgba(24,26,34,0.65);
  margin-bottom: 6px;
}
.v {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  color: var(--rw-dark-1);
}
.small {
  font-size: 12px;
  color: rgba(24,26,34,0.72);
  margin-top: 4px;
  line-height: 1.35;
}
.pill.green { background: var(--rw-light); border: 1px solid rgba(242,107,29,0.35); color: var(--rw-orange); }
.pill.red { background: rgba(24,26,34,0.08); border: 1px solid var(--rw-border); color: var(--rw-dark-1); }
.pill.gray { background: rgba(255,255,255,0.7); border: 1px solid var(--rw-border); color: var(--rw-dark-3); }

.table { width:100%; border-collapse: collapse; margin-top: 6px; }
.table th, .table td { text-align:left; padding: 10px; border-bottom: 1px solid var(--rw-border); font-size: 13px; color: var(--rw-dark-1); }
.table tr:hover { background: var(--rw-light); cursor:pointer; }

.modal {
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 20px;
}
.modal.hidden { display:none; }

@media (max-width: 720px) {
  .row { flex-direction: column; align-items: flex-start; }
  .user-panel { width: 100%; justify-content: space-between; }
  .hero-top { flex-direction: column; align-items: flex-start; }
  .logo-wrap img { height: 30px; }
}

/* --- CRM edit mode helpers --- */
.crm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.crm-grid .full-span { grid-column: 1 / -1; }

.client-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.crm-kv {
  background: #fff;
  border: 1px solid var(--rw-border);
  border-radius: 12px;
  padding: 12px;
}
.crm-kv .value {
  font-weight: 800;
  color: var(--rw-dark-1);
  margin-top: 6px;
  white-space: pre-line;
}
.crm-kv .muted {
  color: rgba(24,26,34,0.65);
  margin: 0;
}

.note-card {
  margin-top: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--rw-border);
  border-radius: 12px;
}
.note-card .note-body {
  color: var(--rw-dark-1);
  margin-top: 6px;
}
.note-card.empty .note-body {
  color: rgba(24,26,34,0.65);
  font-style: italic;
}

.list-row.active {
  background: var(--rw-light);
  border-left: 3px solid var(--rw-orange);
}
