/* The settings dialog and the chat and project dialogs. */

/* ---------- Settings ---------- */

/* "Parley 1.0.0" next to the dialog title */
.modal-version {
  margin-right: auto;
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: -6px 0 12px;
}

.server-card,
.memory-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.server-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.server-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13.5px;
  min-width: 0;
}

.server-title strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.server-detail {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-detail code {
  color: var(--text-muted);
}

.tools-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 260px;
  overflow: auto;
}

.tool-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}

.tool-row:last-child {
  border-bottom: none;
}

.tool-row code {
  color: var(--amber);
  font-size: 12px;
}

.tool-row span {
  color: var(--text-muted);
}

.test-result {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  border-left: 2px solid var(--line);
}

.test-result.ok {
  border-left-color: var(--ok);
  background: var(--ok-wash);
  color: #cfe0bb;
}

.test-result.error {
  border-left-color: var(--danger);
  background: var(--danger-wash);
  color: #f0c4b8;
}

.memory-list {
  display: grid;
  gap: 0;
}

.memory-card.editing {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.memory-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.memory-card-head strong {
  font-weight: 600;
  font-size: 13.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.memory-content {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.memory-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
}

.memory-card:hover .memory-actions,
.memory-card:focus-within .memory-actions {
  opacity: 1;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.user-table th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 500;
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.user-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.user-table td:nth-child(2) {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.user-table tr:last-child td {
  border-bottom: none;
}

.user-table strong {
  font-weight: 600;
}

.user-table .select,
.user-table .input {
  height: 28px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 12.5px;
  width: auto;
  min-width: 90px;
}

.user-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.inline-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.inline-form .field {
  min-width: 0;
}

/* ---------- Chat settings dialog ---------- */

.model-settings {
  display: grid;
  gap: 16px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--amber);
}

.temp-value {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.field-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- Tables in settings ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-faint);
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.data-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.data-table .num.strong {
  color: var(--text);
}

.data-table code {
  font-size: 12px;
}

.usage-days {
  display: grid;
  gap: 4px;
}

.usage-day {
  display: grid;
  grid-template-columns: 44px 1fr 56px;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.usage-bar {
  height: 8px;
  background: var(--line-soft);
}

.usage-bar span {
  display: block;
  height: 100%;
  background: var(--amber);
}

.usage-value {
  text-align: right;
}

/* ---------- Settings: models, devices, notifications ---------- */
.form-actions.start {
  justify-content: flex-start;
  margin-top: 10px;
}

.form-actions .btn svg {
  width: 14px;
  height: 14px;
}

.model-filter {
  margin-top: 10px;
}

.model-settings-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  max-height: 420px;
  overflow-y: auto;
}

.model-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.model-row:last-child {
  border-bottom: 0;
}

.model-row .model-id {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
}

.model-row.is-hidden .model-id {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-color: var(--line);
}

.model-toggle {
  color: var(--text-faint);
}

.model-toggle.on {
  color: var(--amber);
}

.model-toggle.on svg {
  fill: currentColor;
  fill-opacity: 0.25;
}

.sessions-table .badge {
  margin-left: 6px;
  color: var(--amber);
  border-color: rgba(224, 160, 64, 0.4);
}

.table-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.table-actions {
  text-align: right;
}

@media (max-width: 640px) {
  .sessions-table th:nth-child(3),
  .sessions-table td:nth-child(3) {
    display: none;
  }
}

/* ---------- Project files ---------- */
.project-files {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.project-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.project-file:last-child {
  border-bottom: 0;
}

.project-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.project-file-name:hover {
  color: var(--amber);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-file-meta {
  flex: 1;
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

.warn-text {
  color: var(--amber);
}

#project-instructions {
  width: 100%;
}

/* ---------- Memory: topic area headings ---------- */
.category-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-head .icon-btn {
  opacity: 0;
  transition: opacity 0.12s;
}

.settings-section:hover .category-head .icon-btn,
.category-head .icon-btn:focus-visible {
  opacity: 1;
}

.category-rename {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.category-rename .input {
  max-width: 260px;
  padding: 5px 10px;
  font-size: 14px;
}

.category-rename + .form-hint {
  margin: 0 0 12px;
}

/* "p. 203" in an answer: opens the PDF at that page */
.page-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--amber);
  text-underline-offset: 3px;
}

.page-link:hover {
  color: var(--amber);
  text-decoration-style: solid;
}
