/* ============================================================
   DIALED — Shared components
   ============================================================ */

/* ---------------- Chips / toggles ---------------- */
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-12);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.chip.is-active {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: var(--fs-16);
  transition: all var(--dur-fast) var(--ease);
}
.icon-btn:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.toggle-btn {
  padding: 6px 12px;
  font-size: var(--fs-12);
  color: var(--text-muted);
  border-radius: var(--r-md);
}
.toggle-btn.is-active { background: var(--bg-raised); color: var(--text-primary); }

/* ---------------- Buttons ---------------- */
.btn-primary {
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease);
}
.btn-primary:hover { background: #5a8bea; }

.btn-ghost {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease);
}
.btn-ghost:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.btn-danger-ghost {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  color: var(--loss);
  transition: all var(--dur-fast) var(--ease);
}
.btn-danger-ghost:hover { background: var(--loss-wash); border-color: var(--loss); }

.btn-file-label { position: relative; overflow: hidden; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 9, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn var(--dur-med) var(--ease);
}
.modal-overlay[hidden] {
  display: none;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 560px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: modalIn var(--dur-med) var(--ease);
}
.modal--narrow { width: 480px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.modal-close {
  color: var(--text-muted);
  font-size: var(--fs-14);
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
}
.modal-close:hover { background: var(--bg-raised); color: var(--text-primary); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-foot-right { display: flex; gap: 10px; margin-left: auto; }

.modal-input, .modal-textarea, select.modal-input {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 11px;
  font-size: var(--fs-14);
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease);
}
.modal-input:focus, .modal-textarea:focus { border-color: var(--accent); }
.modal-input::placeholder, .modal-textarea::placeholder { color: var(--text-faint); }

.modal-input--title {
  font-size: var(--fs-18);
  font-weight: 600;
  padding: 6px 2px;
  border: none;
  background: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.modal-input--title:focus { border-bottom-color: var(--accent); }

.modal-textarea { resize: vertical; font-family: var(--font-sans); line-height: 1.6; }

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-grid--3 { grid-template-columns: 1fr 1fr 1fr; }

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal-field label {
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.modal-field select {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 11px;
  font-size: var(--fs-13);
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236B7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.modal-field select:focus { border-color: var(--accent); }

.modal-field input[type="date"] {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 11px;
  font-size: var(--fs-13);
  color: var(--text-primary);
  font-family: var(--font-mono);
  color-scheme: dark;
}

html[data-theme="light"] .modal-field input[type="date"] {
  color-scheme: light;
}

.link-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.link-row {
  display: flex;
  gap: 6px;
}
.link-row input {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 7px 10px;
  font-size: var(--fs-13);
  color: var(--text-primary);
}
.link-row .link-row-label { width: 34%; }
.link-row .link-row-url { flex: 1; font-family: var(--font-mono); font-size: var(--fs-12); }
.link-row-remove {
  width: 30px; flex-shrink: 0;
  color: var(--text-faint);
  border-radius: var(--r-sm);
}
.link-row-remove:hover { color: var(--loss); background: var(--loss-wash); }

.link-add-btn {
  align-self: flex-start;
  font-size: var(--fs-12);
  color: var(--accent);
  padding: 4px 0;
}
.link-add-btn:hover { text-decoration: underline; }

.attach-row { display: flex; gap: 8px; }
.attach-preview {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  max-height: 160px;
}
.attach-preview img { width: 100%; display: block; object-fit: cover; max-height: 160px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  z-index: 200;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  animation: toastIn var(--dur-med) var(--ease);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------- Empty state ---------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  color: var(--text-faint);
  font-size: var(--fs-13);
  text-align: center;
  padding: 40px;
}
.empty-state-mark {
  font-family: var(--font-mono);
  font-size: var(--fs-24);
  color: var(--line-strong);
}

/* ---------------- Priority / status dots ---------------- */
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot--high { background: var(--loss); }
.dot--medium { background: var(--warn); }
.dot--low { background: var(--text-faint); }

.tag-pill {
  font-family: var(--font-mono);
  font-size: var(--fs-10);
  padding: 2px 7px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.outcome-badge {
  font-family: var(--font-mono);
  font-size: var(--fs-10);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.outcome-badge--win { background: var(--gain-wash); color: var(--gain); }
.outcome-badge--loss { background: var(--loss-wash); color: var(--loss); }
.outcome-badge--neutral { background: rgba(139,147,161,0.12); color: var(--neutral); }


/* DIALED — tactile controls and surfaces */
.btn-primary, .btn-ghost, .btn-danger-ghost {
  border-radius: 12px;
}

.btn-primary {
  min-height: 40px;
  padding-inline: 18px;
  box-shadow: 0 7px 20px rgba(74,127,224,.16);
}

.btn-ghost {
  background: rgba(255,255,255,.015);
}

.chip {
  border-radius: 999px;
  transition: all var(--dur-fast) var(--ease-spring);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(255,255,255,.018);
}

.toggle-btn {
  border-radius: 9px;
}

.modal-overlay {
  background: rgba(4,5,7,.68);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.modal {
  border-radius: 22px;
  box-shadow:
    0 30px 90px rgba(0,0,0,.52),
    0 1px 0 rgba(255,255,255,.035) inset;
  animation: modalIn var(--dur-med) var(--ease-spring);
}

html[data-theme="light"] .modal {
  box-shadow:
    0 30px 90px rgba(0,0,0,.14),
    0 1px 0 rgba(255,255,255,.9) inset;
}

html[data-theme="light"] .modal-overlay {
  background: rgba(180,185,195,.55);
}

.modal-input, .modal-textarea, select.modal-input {
  border-radius: 12px;
  min-height: 42px;
  transition: border-color var(--dur-fast) var(--ease-smooth),
              box-shadow var(--dur-fast) var(--ease-smooth),
              background var(--dur-fast) var(--ease-smooth);
}

.modal-input:focus, .modal-textarea:focus {
  box-shadow: 0 0 0 3px rgba(74,127,224,.10);
}

.toast {
  border-radius: 14px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
