/*
 * The CRM's own pieces, on top of pricelist's staff styles (application.css, admin.css):
 * filters, two-line rows, the record page (facts, timeline) and tasks.
 */

.sidebar h1 small { display: block; margin-top: 6px; font-size: 11px; letter-spacing: 3px; color: rgba(255, 255, 255, .5); }

#admin .page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#admin .page-head .actions form { display: inline-block; }
#admin .page-head p .pill { margin-right: 6px; }

/* Filters: status toggles, then rows of selects */
#admin .deal-filters { margin: 18px 0 8px; }
#admin .deal-filters .filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
#admin .deal-filters input[type=search] { flex: 1 1 260px; }
#admin .deal-filters input, #admin .deal-filters select, #admin .note-form textarea, #admin .reply textarea,
#admin .panel-row input[type=text], #admin .panel-row input[type=number] {
  padding: 8px 10px; font-size: 14px; font-family: var(--font-ui); color: var(--ink);
  border: 1px solid var(--border); border-radius: 4px; background: #fff;
}
#admin .deal-filters label.check, #admin label.check { font-size: 13px; color: var(--text); display: inline-flex; gap: 5px; align-items: center; }
#admin .totals { margin: 16px 0 6px; font-size: 15px; color: var(--text); }
#admin .totals strong { font-weight: 500; color: var(--ink); }
#admin table.totals-table { max-width: 560px; margin: 8px 0 16px; }

/* Two-line rows: what it is, then where it stands; the whole row opens it */
#admin ul.rows { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid rgba(0, 0, 0, .12); }
#admin ul.rows li a:not(.button) {
  display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px 11px;
  text-decoration: none; border-bottom: 1px solid rgba(0, 0, 0, .07);
}
#admin ul.rows li a:not(.button):hover { background: var(--bg-tint); }
#admin ul.rows .main, #admin ul.rows .aside { display: flex; flex-direction: column; min-width: 0; }
#admin ul.rows .aside { align-items: flex-end; flex: none; text-align: right; }
#admin ul.rows .name { font-size: 15px; line-height: 20px; color: var(--ink); }
#admin ul.rows .sub, #admin ul.rows .state { margin-top: 3px; font-size: 12px; line-height: 15px; letter-spacing: .3px; color: var(--text-muted); }
#admin ul.rows .amount { font-size: 15px; line-height: 20px; color: var(--ink); }
#admin ul.rows .state.won { color: #3a9a5c; }
#admin ul.rows .state.lost { color: #98a3a9; }
#admin ul.rows .state.pending { color: var(--accent); }
#admin ul.rows.compact { margin-bottom: 18px; }
#admin .pager { display: flex; gap: 24px; margin: 16px 0; font-size: 14px; }
#admin nav.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
#admin nav.letters a:not(.button) { padding: 4px 8px; font-size: 13px; color: var(--text); text-decoration: none; border-radius: 4px; }
#admin nav.letters a.current { color: #fff; background: var(--ink); }

#admin .pill.pending { color: #fff; background: var(--accent); }
#admin .pill.won { color: #fff; background: #3a9a5c; }
#admin .pill.lost { color: #fff; background: var(--text-muted); }

/* A deal's or contact's page: facts and history, background on the side */
#admin .record { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; margin-top: 18px; }
#admin dl.facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 16px; margin: 0 0 22px; font-size: 15px; }
#admin dl.facts dt { font-size: 12px; line-height: 20px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
#admin dl.facts dt small { text-transform: none; letter-spacing: 0; }
#admin dl.facts dd { font-family: var(--font-body); font-size: 16px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
#admin dl.facts.invoice { max-width: 720px; }
#admin .record-side .background { font-family: var(--font-body); font-size: 15px; line-height: 22px; color: var(--text); overflow-wrap: anywhere; }
#admin .record-side .background p + p { margin-top: 8px; }
#admin .muted { color: var(--text-muted); }
.flash.view-only { background: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 400; }
#admin .private-mark { display: inline-block; margin-right: 6px; padding: 1px 6px; font-size: 11px; letter-spacing: .5px;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 3px; vertical-align: 1px; }

#admin .note-form { margin: 8px 0 20px; }
#admin .note-form textarea { width: 100%; box-sizing: border-box; font-family: var(--font-body); font-size: 16px; resize: vertical; }
#admin .note-form .note-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: 13px; }

#admin ol.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
#admin ol.timeline > li { padding: 12px 0 14px; border-bottom: 1px solid rgba(0, 0, 0, .07); }
#admin ol.timeline .meta { font-size: 12px; line-height: 16px; letter-spacing: .3px; color: var(--text-muted); }
#admin ol.timeline .meta strong { font-weight: 500; color: var(--text); }
#admin ol.timeline .title { margin-top: 4px; font-size: 15px; color: var(--ink); }
#admin ol.timeline .body { margin-top: 5px; font-family: var(--font-body); font-size: 16px; line-height: 23px; color: var(--ink); overflow-wrap: anywhere; }
#admin ol.timeline .body p + p { margin-top: 8px; }
#admin ol.timeline .body.small { font-size: 15px; color: var(--text); }
#admin ol.timeline ul.files { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
#admin ol.timeline ul.files small { color: var(--text-muted); }
#admin ol.timeline ol.comments { list-style: none; margin: 10px 0 0 18px; padding: 0 0 0 14px; border-left: 2px solid var(--bg-placeholder); }
#admin ol.timeline ol.comments li + li { margin-top: 10px; }
#admin ol.timeline details.reply { margin-top: 6px; font-size: 13px; }
#admin ol.timeline details.reply summary { cursor: pointer; color: var(--accent); }
#admin ol.timeline details.reply textarea { display: block; width: 100%; box-sizing: border-box; margin: 6px 0; font-family: var(--font-body); font-size: 15px; }

/* Tasks: a tick box, then what and when */
#admin .tasks-panel { margin-bottom: 22px; }
#admin .task-row form.tick { flex: none; }
#admin .task-row form.tick input { width: 18px; height: 18px; cursor: pointer; }
#admin .task-row.done .line { text-decoration: line-through; color: var(--text-muted); }
#admin .task-row.overdue small { color: var(--error); }
#admin .panel-row .item { flex: 1 1 auto; min-width: 0; text-decoration: none; }
#admin p.about { margin-top: 12px; font-size: 15px; }
#admin details.void summary { cursor: pointer; font-size: 13px; color: var(--error); }
#admin details.void form { display: flex; gap: 6px; margin-top: 6px; }
#admin .detail-row .field.wide { flex: 2 1 260px; }
#admin .hint { margin-top: 6px; }
#admin .panel-row input[type=text] { flex: 0 1 300px; }

@media (max-width: 899px) {
  #admin .record { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #admin dl.facts { grid-template-columns: 100px minmax(0, 1fr); }
}
