/* ---- Reset ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif; 
  background: #ffffff; 
  color: #111111; 
  height: 100vh; 
  display: flex; 
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e8e8e8;
  height: 100vh;
  overflow: hidden;
  background: #fff;
}

.sidebar-header {
  padding: 20px 16px 16px;
}

.sidebar-logo {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #111;
}

.sidebar-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #aaa;
  margin-top: 2px;
  margin-bottom: 14px;
}

.sidebar-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: #111;
}

.stat-label {
  font-size: 11px;
  color: #bbb;
}

/* ---- Sidebar sections ---- */
.sidebar-section {
  padding: 0 16px;
  margin-bottom: 16px;
}

.sidebar-section-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 8px;
  padding-top: 12px;
  border-top: 1px solid #e8e8e8;
}

/* ---- Mode buttons ---- */
.mode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  margin-bottom: 6px;
  transition: all 0.15s;
}

.mode-btn:hover {
  border-color: #ccc;
}

.mode-btn.active {
  border-color: #1a3a5c;
  background: #f5f8fb;
}

.mode-icon {
  font-size: 18px;
}

.mode-title {
  font-size: 12px;
  font-weight: 600;
  color: #111;
}

.mode-desc {
  font-size: 10px;
  color: #999;
}

/* ---- Segment list ---- */
.segment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}

.segment-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: #444;
  text-align: left;
  transition: background 0.15s;
}

.segment-btn:hover:not(.disabled) {
  background: #f5f5f5;
}

.segment-btn.active {
  background: #f5f5f5;
  font-weight: 600;
  color: #111;
}

.segment-btn.disabled {
  opacity: 0.4;
  cursor: default;
}

.segment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.segment-count {
  margin-left: auto;
  font-size: 11px;
  color: #bbb;
}

/* ---- Conversation list ---- */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.conv-btn {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.conv-btn:hover {
  background: #f5f5f5;
}

.conv-btn.active {
  background: #f0f4f8;
}

.conv-title {
  font-size: 12px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-btn.active .conv-title {
  font-weight: 600;
  color: #111;
}

.conv-meta {
  font-size: 10px;
  color: #bbb;
  margin-top: 1px;
}

.btn-new-conv {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-new-conv:hover {
  border-color: #1a3a5c;
  color: #1a3a5c;
}

/* ---- Profile name ---- */
.profile-name {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin-bottom: 2px;
}

/* ---- Sidebar footer ---- */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid #e8e8e8;
}

.footer-badge {
  font-size: 10px;
  font-weight: 600;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.footer-note {
  font-size: 10px;
  color: #ccc;
  margin-top: 2px;
}

/* ---- Main content ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mode-view {
  display: none;
  flex-direction: column;
  height: 100%;
}

.mode-view.active {
  display: flex;
}

/* ---- Profile card ---- */
.profile-card {
  border-bottom: 1px solid #e8e8e8;
  background: #fafafa;
}

.profile-header {
  padding: 8px 24px 0;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1a3a5c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
}

.profile-title-line {
  font-size: 12px;
  color: #888;
  margin-top: 1px;
}

.profile-segment-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 3px;
  background: #e94560;
  color: #fff;
  margin-left: auto;
  white-space: nowrap;
}

.profile-body {
  display: flex;
  gap: 0;
  padding: 6px 24px 8px;
  max-height: 120px;
  overflow: hidden;
  transition: max-height 0.3s ease;
  width: 100%;
}

.profile-body.expanded {
  max-height: 800px;
  overflow-y: auto;
}

.profile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  border-top: 1px solid #eee;
  background: #fafafa;
  color: #bbb;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  user-select: none;
}

.profile-toggle:hover {
  color: #888;
  background: #f0f0f0;
}

.profile-col {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  border-left: 1px solid #e8e8e8;
  overflow: hidden;
}

/* Give brand map more room */
.profile-col:nth-child(3) {
  flex: 1.5;
}

/* Tool drawer is more compact */
.profile-col:nth-child(2) {
  flex: 0.8;
}

.profile-col:first-child {
  padding-left: 0;
  border-left: none;
}

.profile-col-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 2px;
}

.profile-meta {
  font-size: 11px;
  color: #555;
  line-height: 1.4;
}

.profile-meta-item {
  display: flex;
  gap: 6px;
}

.profile-meta-label {
  color: #aaa;
  font-size: 11px;
  min-width: 55px;
  flex-shrink: 0;
}

.profile-meta-value {
  color: #444;
}

.profile-tools {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: visible;
}

.tool-sub-col {
  flex: 1;
  padding: 0 8px;
  border-left: 1px solid #eee;
}

.tool-sub-col:first-child {
  padding-left: 0;
  border-left: none;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1.5;
}

.tool-status {
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tool-status.go-to { background: #e8f5e9; color: #2e7d32; }
.tool-status.rotation { background: #e3f2fd; color: #1565c0; }
.tool-status.backup { background: #f3e5f5; color: #7b1fa2; }
.tool-status.retired { background: #f5f5f5; color: #999; }
.tool-status.owned { background: #fff3e0; color: #e65100; }
.tool-status.daily { background: #e8f5e9; color: #2e7d32; }

.tool-name {
  color: #333;
  white-space: nowrap;
}

.tool-section-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ccc;
  margin-bottom: 2px;
}

.profile-brands {
  font-size: 11px;
  line-height: 1.5;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 1px 0;
}

.brand-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.brand-dot.primary { background: #2e7d32; }
.brand-dot.secondary { background: #43a047; }
.brand-dot.tried { background: #f9a825; }
.brand-dot.former { background: #ef6c00; }
.brand-dot.interested { background: #7c4dff; }
.brand-dot.curious { background: #ab47bc; }
.brand-dot.liked { background: #1e88e5; }
.brand-dot.respected { background: #0288d1; }
.brand-dot.avoided { background: #d32f2f; }
.brand-dot.aware { background: #90a4ae; }
.brand-dot.unaware { background: #cfd8dc; }
/* Duluth-specific relationship types */
.brand-dot.regular { background: #1e88e5; }
.brand-dot.occasional { background: #26a69a; }
.brand-dot.growing { background: #66bb6a; }
.brand-dot.fading { background: #ef5350; }
.brand-dot.vague { background: #b0bec5; }

.brand-name {
  color: #333;
  font-weight: 500;
  min-width: 45px;
  max-width: 65px;
  font-size: 10px;
  flex-shrink: 0;
}

.brand-opinion {
  color: #999;
  font-size: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 2px 0;
  cursor: pointer;
  position: relative;
}

.brand-row:hover {
  background: #f4f6fa;
  border-radius: 3px;
  margin: 0 -4px;
  padding: 2px 4px;
}

.brand-row:hover .brand-opinion {
  white-space: normal;
  overflow: visible;
  color: #555;
}

.btn-new {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-new:hover {
  border-color: #1a3a5c;
  color: #1a3a5c;
}

/* ---- Chat area ---- */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  max-width: 800px;
}

.message {
  margin-bottom: 16px;
  max-width: 85%;
}

.message.user {
  margin-left: auto;
}

.msg-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  margin-bottom: 4px;
}

.message.user .msg-label {
  text-align: right;
}

.msg-bubble {
  padding: 12px 16px;
  line-height: 1.65;
  font-size: 14px;
  border-radius: 8px;
}

.message.user .msg-bubble {
  background: #f5f8fb;
  border: 1px solid #e0e8f0;
  color: #333;
  border-radius: 8px 8px 2px 8px;
}

.message.assistant .msg-bubble {
  background: #fff;
  border: 1px solid #e8e8e8;
  color: #444;
  border-radius: 8px 8px 8px 2px;
}

.typing {
  font-size: 13px;
  color: #aaa;
  font-style: italic;
  padding: 8px 16px;
}

/* ---- Input area ---- */
.input-area {
  padding: 12px 24px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-area input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  outline: none;
  color: #111;
  background: #fafafa;
  transition: border-color 0.15s;
}

.input-area input[type="text"]:focus {
  border-color: #1a3a5c;
  background: #fff;
}

.btn-upload {
  font-size: 20px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  user-select: none;
}

.btn-upload:hover {
  background: #f0f0f0;
}

.upload-preview {
  display: none;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.upload-thumb {
  position: relative;
  width: 80px;
}

.upload-thumb img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.upload-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d32f2f;
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}

.upload-name {
  display: block;
  font-size: 9px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-images {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.msg-image {
  max-width: 320px;
  max-height: 240px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
}

.msg-image:hover {
  opacity: 0.9;
}

.btn-send {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: #111;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-send:hover {
  background: #222;
}

.btn-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ---- Coming soon ---- */
/* Panel Builder */
.preset-btn {
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  color: #555;
}
.preset-btn:hover { background: #f5f5f5; }
.preset-btn.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

.size-btn {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  color: #555;
}
.size-btn:hover { background: #f5f5f5; }
.size-btn.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

.seg-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
}
.seg-slider-row input[type=checkbox] { flex-shrink: 0; }
.seg-slider-row .seg-name { flex: 1; color: #555; min-width: 80px; }
.seg-slider-row input[type=range] { flex: 2; height: 4px; }
.seg-slider-row .seg-pct { width: 32px; text-align: right; color: #888; font-size: 10px; }
.seg-slider-row .seg-n { width: 28px; text-align: right; color: #aaa; font-size: 10px; }

.survey-response-card {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}
.survey-response-card .resp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.survey-response-card .resp-name { font-weight: 600; font-size: 12px; color: #333; }
.survey-response-card .resp-segment {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
}
.survey-response-card .resp-text { font-size: 12px; color: #555; line-height: 1.5; }

.survey-agg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 12px;
}
.survey-agg-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid #ddd;
  color: #999;
  font-size: 10px;
  text-transform: uppercase;
}
.survey-agg-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f0f0f0;
  color: #444;
}

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.coming-soon-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.coming-soon h2 {
  font-size: 20px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}

.coming-soon p {
  font-size: 14px;
  color: #888;
  max-width: 400px;
  line-height: 1.6;
}

.coming-soon-status {
  margin-top: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #1a3a5c;
  padding: 4px 12px;
  background: #f0f4f8;
  border-radius: 4px;
}
