/* styles-additions-v6.css — Sprint 2.2
   Touch-centric panel + Edit details modal + Account picker modal
   The !important rules at top are robust panel show/hide that ignore
   whatever the legacy CSS does. */


/* ===== ROBUST PANEL SHOW/HIDE — fixes regression in 2.1 ===== */

/* Default closed state — panel hidden off-screen, overlay invisible */
#panel {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: -560px;
  width: 540px !important;
  max-width: 90vw !important;
  background: #fdfcf9 !important;
  z-index: 200 !important;
  overflow-y: auto !important;
  transition: right 0.25s cubic-bezier(.2,.7,.3,1) !important;
  box-shadow: -16px 0 32px rgba(0,0,0,0.15) !important;
  visibility: visible !important;
  display: block !important;
  transform: none !important;
  opacity: 1 !important;
}

#panel.panel-open {
  right: 0 !important;
}

#panel-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.4) !important;
  z-index: 199 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s !important;
  visibility: visible !important;
  display: block !important;
}

#panel-overlay.panel-overlay-open {
  opacity: 1 !important;
  pointer-events: auto !important;
}


/* ===== Touch-centric panel ===== */
.tcpanel {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: 'IBM Plex Sans', sans-serif;
}

.tcpanel-header {
  position: relative;
  padding: 28px 24px 20px;
  border-bottom: 1px solid #ebe7df;
}

.tcpanel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #888780;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.tcpanel-close:hover { color: #1a1a1a; }

/* Pencil edit icon — small, unobtrusive */
.tcpanel-edit-btn {
  position: absolute;
  top: 22px;
  right: 56px;
  background: transparent;
  border: 0;
  font-size: 15px;
  color: #b3b0a6;
  cursor: pointer;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 4px;
  transition: all 0.12s;
}
.tcpanel-edit-btn:hover {
  color: #1a1a1a;
  background: #f7f5f1;
}

.tcpanel-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 70px; /* leave room for close + edit buttons */
}

.tcpanel-watched-star {
  background: transparent;
  border: 0;
  font-size: 22px;
  color: #d8d6d0;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
  transition: color 0.12s, transform 0.08s;
}
.tcpanel-watched-star:hover { transform: scale(1.1); }
.tcpanel-watched-on { color: #C49B3A; }

.tcpanel-name {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 500;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.2;
}

.tcpanel-meta {
  margin-top: 6px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
}
.tcpanel-meta-extra {
  margin-top: 4px;
  font-size: 12px;
  color: #6b6960;
  font-family: 'IBM Plex Sans', sans-serif;
  letter-spacing: 0;
  text-transform: none;
}
.tcpanel-meta-extra a {
  color: #1F5D9D;
  text-decoration: none;
}
.tcpanel-meta-extra a:hover { text-decoration: underline; }

/* Sections */
.tcpanel-section {
  padding: 20px 24px;
  border-bottom: 1px solid #f3f0e9;
}
.tcpanel-section:last-child { border-bottom: 0; }

.tcpanel-section-label {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
}

/* At a glance — stats grid */
.tcpanel-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
@media (max-width: 700px) {
  .tcpanel-stats { grid-template-columns: repeat(2, 1fr); }
}
.tcpanel-stat label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #b3b0a6;
  margin-bottom: 4px;
}
.tcpanel-stat strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.2;
}
.tcpanel-stat span {
  display: block;
  font-size: 11px;
  color: #888780;
  margin-top: 2px;
}

/* Revenue stream pills */
.tcpanel-streams {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tcpanel-stream-pill {
  background: transparent;
  border: 1px solid #d8d6d0;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b6960;
  transition: all 0.12s;
}
.tcpanel-stream-pill:hover { border-color: #1a1a1a; }
.tcpanel-stream-on {
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--pill-color);
  box-shadow: inset 0 0 0 1px var(--pill-color);
}
.tcpanel-stream-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tcpanel-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #b3b0a6;
  font-style: italic;
}

/* Touch history section */
.tcpanel-history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tcpanel-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.tcpanel-history-count {
  display: inline-block;
  margin-left: 6px;
  color: #b3b0a6;
  font-weight: 500;
  font-size: 12px;
}
.tcpanel-history-add {
  background: #1a1a1a;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}
.tcpanel-history-add:hover { background: #2a2a2a; }

.tcpanel-history-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tcpanel-empty {
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: #b3b0a6;
  background: #f7f5f1;
  border-radius: 6px;
}

.tcpanel-touch-row {
  display: flex;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f3f0e9;
}
.tcpanel-touch-row:hover { background: #f7f5f1; }
.tcpanel-touch-row:last-child { border-bottom: 0; }

.tcpr-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ebe7df;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #6b6960;
}
.tcpr-meta {
  flex: 1;
  min-width: 0;
}
.tcpr-line-1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b6960;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.tcpr-channel {
  font-weight: 600;
  color: #1a1a1a;
}
.tcpr-direction { color: #b3b0a6; }
.tcpr-date { color: #888780; }
.tcpr-contact { color: #1F5D9D; font-size: 11px; }

.tcpr-line-2 {
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tcpr-line-full {
  display: none;
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1.55;
  white-space: pre-wrap;
  margin-top: 4px;
}
.tcpanel-touch-row-expanded .tcpr-line-2 { display: none; }
.tcpanel-touch-row-expanded .tcpr-line-full { display: block; }
.tcpr-empty { color: #b3b0a6; }

.tcpr-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.tcpr-badge-planned { background: #E6F1FB; color: #1F5D9D; }
.tcpr-badge-missed { background: #FAECE7; color: #993C1D; }
.tcpr-badge-cancelled { background: #f3f0e9; color: #888780; }


/* ===== Account Edit Modal ===== */
.aem-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  z-index: 9100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  overflow-y: auto;
}
.aem-overlay.aem-open { display: flex; }

.aem-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.aem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 14px;
  border-bottom: 1px solid #ebe7df;
}
.aem-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
}
.aem-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #888780;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.aem-close:hover { color: #1a1a1a; }

.aem-form {
  padding: 16px 24px 20px;
}

.aem-row { margin-bottom: 14px; }
.aem-row-grid {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 14px;
}
.aem-row-grid-3 {
  display: grid;
  grid-template-columns: 1fr 80px 100px;
  gap: 14px;
}
@media (max-width: 480px) {
  .aem-row-grid-3 { grid-template-columns: 1fr; }
}
.aem-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
}
.aem-form input,
.aem-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: #1a1a1a;
  font-family: 'IBM Plex Sans', sans-serif;
}
.aem-form textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}
.aem-form input:focus,
.aem-form textarea:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.aem-section-divider {
  margin: 16px 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #b3b0a6;
  border-top: 1px solid #f3f0e9;
  padding-top: 14px;
}

.aem-error {
  background: #FAECE7;
  color: #993C1D;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.aem-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #ebe7df;
}
.aem-spacer { flex: 1; }
.aem-delete,
.aem-cancel,
.aem-save {
  padding: 9px 18px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
}
.aem-delete {
  background: transparent;
  color: #993C1D;
  border-color: #FAECE7;
}
.aem-delete:hover { background: #FAECE7; }
.aem-cancel {
  background: #fff;
  color: #1a1a1a;
  border-color: #d8d6d0;
}
.aem-cancel:hover { background: #f7f5f1; }
.aem-save {
  background: #1a1a1a;
  color: #fff;
}
.aem-save:hover { background: #2a2a2a; }
.aem-save:disabled { opacity: 0.6; cursor: not-allowed; }


/* ===== Account Picker Modal ===== */
.apm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  z-index: 9050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
}
.apm-overlay.apm-open { display: flex; }

.apm-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.apm-header {
  padding: 18px 24px 12px;
  border-bottom: 1px solid #ebe7df;
}
.apm-header h2 {
  margin: 0 0 10px;
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 500;
  color: #1a1a1a;
}
.apm-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
}
.apm-search:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}
.apm-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.apm-row {
  padding: 10px 24px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f3f0e9;
}
.apm-row:hover {
  background: #f7f5f1;
}
.apm-row-name {
  font-weight: 500;
  color: #1a1a1a;
  font-size: 14px;
}
.apm-row-meta {
  font-size: 12px;
  color: #888780;
  margin-top: 2px;
}
.apm-empty {
  padding: 24px;
  text-align: center;
  color: #b3b0a6;
  font-size: 13px;
}


/* ===== Smart context strip in TouchModal ===== */
.tm-context-strip {
  background: #fdfaf3;
  border: 1px solid #f0e8d3;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
.tm-context-strip-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
  margin-bottom: 4px;
}
.tm-context-strip-text {
  color: #1a1a1a;
  line-height: 1.4;
}
.tm-context-strip-text strong {
  font-weight: 600;
}
