/* Sidebar Dropdown Group for Patient Automations */
.sidebar-dropdown-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-dropdown-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
}

.sidebar-dropdown-toggle:hover {
  background: rgba(57, 197, 188, 0.1);
  color: #f8fafc;
}

.sidebar-dropdown-toggle .dropdown-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-dropdown-toggle .dropdown-chevron {
  font-size: 18px;
  transition: transform 0.2s ease;
  color: #64748b;
}

.sidebar-dropdown-group.open .dropdown-chevron {
  transform: rotate(180deg);
  color: #39c5bc;
}

.sidebar-dropdown-menu {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 16px;
  margin-top: 2px;
}

.sidebar-dropdown-group.open .sidebar-dropdown-menu {
  display: flex;
}

.sidebar-dropdown-menu .sidebar-nav-item {
  font-size: 12.5px;
  padding: 8px 10px;
}

/* Patient Profile View */
.pp-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #0f172a;
  color: #f1f5f9;
  overflow: hidden;
}

.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #111827;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.pp-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-header-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
}

.pp-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(57, 197, 188, 0.15);
  color: #39c5bc;
  border: 1px solid rgba(57, 197, 188, 0.3);
}

.pp-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.pp-left-panel {
  width: 340px;
  flex-shrink: 0;
  background: #111827;
  border-right: 1px solid #1e293b;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.pp-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 6px;
  display: block;
}

.pp-textarea {
  width: 100%;
  min-height: 130px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f8fafc;
  padding: 10px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.pp-textarea:focus {
  outline: none;
  border-color: #39c5bc;
}

.pp-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pp-sec-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #cbd5e1;
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.pp-sec-chk input {
  accent-color: #39c5bc;
}

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

.pp-btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #39c5bc, #2baeba);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pp-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pp-btn-danger {
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid #991b1b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.pp-btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pp-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 16px 20px;
  gap: 12px;
}

.pp-stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pp-stat-pill {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #94a3b8;
}

.pp-stat-pill strong {
  color: #f8fafc;
  margin-left: 4px;
}

.pp-search-filter {
  flex: 1;
  min-width: 180px;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  color: #f8fafc;
  font-size: 13px;
}

.pp-table-wrap {
  flex: 1;
  overflow: auto;
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 10px;
}

.pp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.pp-table th {
  position: sticky;
  top: 0;
  background: #1e293b;
  color: #cbd5e1;
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 1px solid #334155;
}

.pp-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #1e293b;
  color: #e2e8f0;
  vertical-align: middle;
}

.pp-table tr:hover td {
  background: rgba(57, 197, 188, 0.06);
}

.pp-status-found {
  color: #34d399;
  font-weight: 700;
}

.pp-status-miss {
  color: #f87171;
  font-weight: 700;
}

/* Modal */
.pp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.pp-modal-backdrop.open {
  display: flex;
}

.pp-modal {
  width: 100%;
  max-width: 1020px;
  max-height: 88vh;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f1f5f9;
}

.pp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.pp-modal-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 18px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  overflow-x: auto;
  flex-shrink: 0;
}

.pp-tab-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.pp-tab-btn.active {
  background: #39c5bc;
  color: #0f172a;
  border-color: #39c5bc;
}

.pp-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.pp-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.pp-kv-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px;
}

.pp-kv-card .k {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 3px;
}

.pp-kv-card .v {
  font-size: 13px;
  color: #f8fafc;
  font-weight: 600;
  word-break: break-word;
}

/* View Mode Toggle & Excel Mode Grid */
.pp-view-toggle {
  display: inline-flex;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.pp-toggle-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pp-toggle-btn.active {
  background: #39c5bc;
  color: #0f172a;
}

.pp-excel-wrap {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0f172a;
}

.pp-excel-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.pp-excel-table th,
.pp-excel-table td {
  border-right: 1px solid #1e293b;
  border-bottom: 1px solid #1e293b;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-excel-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #1e293b;
}

.pp-excel-filter-row th {
  position: sticky;
  top: 37px;
  z-index: 2;
  background: #0f172a;
  padding: 5px 6px;
}

.pp-col-filter {
  width: 100%;
  min-width: 80px;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #f8fafc;
  font-size: 11px;
  padding: 4px 6px;
}

.pp-col-filter:focus {
  outline: none;
  border-color: #39c5bc;
}

.pp-col-filters-panel {
  background: #111827;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 14px;
  max-height: 190px;
  overflow-y: auto;
  flex-shrink: 0;
}

.pp-col-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: #e2e8f0;
}

.pp-col-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 6px;
}

.pp-col-chk-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-col-chk-label input {
  accent-color: #39c5bc;
  flex-shrink: 0;
}

/* Excel Per-Column AutoFilter Dropdown Popover */
.pp-th-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.pp-th-filter-btn {
  background: #0f172a;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1.2;
  flex-shrink: 0;
}

.pp-th-filter-btn:hover {
  border-color: #39c5bc;
  color: #f8fafc;
}

.pp-th-filter-btn.is-filtered {
  background: #39c5bc;
  color: #0f172a;
  border-color: #39c5bc;
  font-weight: 700;
}

.pp-col-popover {
  position: fixed;
  z-index: 10050;
  width: 260px;
  max-height: 360px;
  background: #0f172a;
  border: 1px solid #39c5bc;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  color: #f1f5f9;
}

.pp-pop-sort-row {
  display: flex;
  gap: 6px;
}

.pp-pop-sort-btn {
  flex: 1;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.pp-pop-sort-btn.active {
  background: rgba(57, 197, 188, 0.2);
  color: #39c5bc;
  border-color: #39c5bc;
}

.pp-pop-search {
  width: 100%;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 8px;
  color: #f8fafc;
  font-size: 12px;
}

.pp-pop-actions {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
}

.pp-pop-actions button {
  background: none;
  border: none;
  color: #39c5bc;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.pp-pop-values {
  flex: 1;
  min-height: 100px;
  max-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 6px;
  background: #111827;
}

.pp-pop-val-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #e2e8f0;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.pp-pop-val-item:hover {
  background: rgba(57, 197, 188, 0.1);
}

.pp-pop-val-item input {
  accent-color: #39c5bc;
  flex-shrink: 0;
}

.pp-pop-val-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



