/* History mode — PhoneCallHistoryView.swift. 1 pt = 1 px. The list takes 44 % of the page, at least 320. */

.history-page { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--window-bg); }
.history-page:not(.is-empty)::after { content: ""; position: absolute; top: 0; bottom: 0; left: max(320px, 44%); width: 1px; background: var(--card-border); pointer-events: none; }

/* header */
.hp-head { flex: none; height: 64px; position: relative; display: grid; grid-template-columns: max(320px, 44%) 1fr; align-items: center; border-bottom: 1px solid var(--card-border); }
.hp-title { grid-row: 1; grid-column: 1; justify-self: start; margin: 0 0 0 24px; max-width: calc(100% - 264px); font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-filter { grid-row: 1; grid-column: 1; justify-self: end; margin-right: 24px; padding: 3px; border-radius: 9px; }
.hp-filter button { height: 26px; }
.history-page.is-empty .hp-filter { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; }
.history-page.is-empty .hp-title { max-width: calc(50% - 140px); }
.hp-search { grid-row: 1; grid-column: 2; justify-self: end; margin-right: 24px; width: 240px; height: 28px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 7px; background: var(--group-fill); color: var(--secondary-label); }
.hp-search:focus-within { box-shadow: 0 0 0 3px rgba(66, 112, 192, .3); }
.hp-search svg.ic { width: 14px; height: 14px; }
.hp-search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--label); }
.hp-search-input::placeholder { color: var(--placeholder); }

/* columns */
.hp-main { flex: 1; min-height: 0; display: flex; }
.hp-list-col { flex: none; width: max(320px, 44%); position: relative; display: flex; flex-direction: column; min-height: 0; }
.hp-list { flex: 1; min-height: 0; overflow-y: auto; outline: none; }
.hp-list-empty { position: absolute; top: 40px; left: 0; right: 0; text-align: center; font-size: 14px; }
.hp-detail-col { flex: 1; min-width: 0; overflow-y: auto; margin-left: 1px; }

/* list rows */
.hp-row { position: relative; height: 76px; display: flex; align-items: center; padding: 0 20px 0 22px; cursor: default; user-select: none; }
.hp-row::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: 0; height: 1px; background: var(--card-border); }
.hp-row.sel { background: rgba(104, 136, 192, .045); }
.hp-list:focus-visible .hp-row.sel { background: rgba(104, 136, 192, .1); }
.hp-avatar { flex: none; border-radius: 50%; background: var(--group-fill); color: var(--secondary-label); display: flex; align-items: center; justify-content: center; }
.hp-avatar svg.ic { width: auto; height: auto; transform: translateY(4%); }
.hp-row-main { flex: 1; min-width: 0; margin-left: 14px; display: flex; flex-direction: column; gap: 4px; }
.hp-row-name { font-size: 15px; font-weight: 600; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-row-sub { display: flex; align-items: center; gap: 5px; font-size: 13px; line-height: 16px; font-variant-numeric: tabular-nums; color: var(--label); min-width: 0; }
.hp-row-sub span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-row-sub svg.ic { width: 12px; height: 12px; }
.hp-row.missed .hp-row-sub { color: var(--red); }
.hp-row-meta { flex: none; margin-left: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; line-height: 19px; }
.hp-row-meta div:last-child { line-height: 16px; }
.hp-info { flex: none; margin-left: 14px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hp-info:hover { background: var(--hover-fill); }

/* detail */
.hp-detail { padding: 24px 28px; display: flex; flex-direction: column; }
.hp-d-head { display: flex; align-items: flex-start; gap: 20px; }
.hp-d-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hp-d-name { font-size: 22px; font-weight: 700; line-height: 27px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-d-name.selectable { user-select: text; }
.hp-d-line { font-size: 14px; line-height: 18px; }
.hp-d-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hp-chip { display: inline-block; height: 30px; line-height: 30px; padding: 0 14px; border-radius: 15px; font-size: 14px; font-weight: 500; text-align: center; white-space: pre; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--label); }
.hp-chip.blue { background: var(--subtle-blue-back); }
.hp-chip.gray { background: var(--group-fill); }
.hp-chip.green { background: rgba(52, 199, 89, .15); color: rgb(34, 129, 58); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hp-chip.green { color: #30D158; } }
.hp-chip.red { background: rgba(255, 59, 48, .12); color: var(--red); }
.hp-call-again { flex: none; height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; border-radius: 19px; border: 1px solid var(--card-border); background: transparent; font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.hp-call-again svg.ic { color: var(--accent); width: 16px; height: 16px; }
.hp-call-again:hover:not(:disabled) { background: var(--hover-fill); }
.hp-call-again:active:not(:disabled) { background: var(--subtle-blue-back); }
.hp-call-again:disabled { opacity: .4; cursor: default; }
.hp-d-line-sep { height: 1px; background: var(--card-border); margin: 24px 0; flex: none; }
.hp-d-title { margin: 0 0 10px; font-size: 20px; font-weight: 700; line-height: 24px; }
.hp-d-none { font-size: 14px; }
.hp-tr-row { position: relative; min-height: 54px; padding: 16px 0 10px 144px; }
.hp-tr-time { position: absolute; left: 0; top: 12px; width: 52px; height: 30px; display: flex; align-items: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.hp-tr-who { position: absolute; left: 64px; top: 12px; min-width: 64px; }
.hp-tr-who.blue { color: var(--accent); }
.hp-tr-lines { display: flex; flex-direction: column; gap: 4px; }
.hp-tr-text { font-size: 15px; line-height: 19px; user-select: text; overflow-wrap: anywhere; white-space: pre-wrap; }
.hp-tr-text.light { font-weight: 300; }
.hp-d-toggle { align-self: flex-start; margin: 10px 0 0 144px; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; }
.hp-d-toggle svg.ic { width: 15px; height: 15px; }

/* empty */
.hp-empty { position: absolute; top: 64px; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; overflow-y: auto; }
.hp-empty-art { position: relative; width: 150px; height: 150px; flex: none; border-radius: 50%; background: var(--group-fill); color: var(--secondary-label); }
.hp-empty-art svg { position: absolute; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.hp-art-phone { left: 34px; top: 62px; }
.hp-art-clock { left: 79px; top: 35px; }
.hp-empty-title { margin-top: 28px; font-size: 26px; font-weight: 700; line-height: 31px; }
.hp-empty-body { margin: 12px 0 0; max-width: 420px; font-size: 16px; line-height: 21px; }
.hp-empty-btn { margin-top: 28px; height: 45px; min-width: 236px; font-size: 15px; font-weight: 500; }

/* menu (NSMenu) */
.hp-menu { position: fixed; z-index: 55; min-width: 180px; padding: 5px; border-radius: 8px; background: color-mix(in srgb, var(--window-bg) 88%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.hp-menu-item { display: block; width: 100%; height: 22px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; text-align: left; font-size: 13px; color: var(--label); cursor: default; white-space: nowrap; outline: none; }
.hp-menu-item:hover, .hp-menu-item:focus { background: var(--accent); color: #fff; }
.hp-menu-sep { height: 1px; margin: 5px 10px; background: var(--separator); }

/* phone width: header wraps, list on top (own scroll), the call under it */
@media (max-width: 900px) {
    .history-page { overflow-y: auto; }
    .history-page:not(.is-empty)::after { display: none; }
    .hp-head { height: auto; grid-template-columns: 1fr auto; gap: 10px 12px; padding: 12px 16px; }
    .hp-title { margin: 0; max-width: 100%; font-size: 20px; }
    .hp-filter { grid-column: 2; margin: 0; }
    .history-page.is-empty .hp-filter { position: static; transform: none; }
    .history-page.is-empty .hp-title { max-width: 100%; }
    .hp-search { grid-row: 2; grid-column: 1 / -1; width: 100%; margin: 0; }
    .hp-main { flex-direction: column; flex: none; }
    .hp-list-col { width: auto; border-bottom: 1px solid var(--card-border); }
    .hp-list { max-height: 45vh; min-height: 120px; }
    .hp-row { padding: 0 12px 0 16px; }
    .hp-row::after { left: 16px; right: 16px; }
    .hp-detail-col { overflow: visible; margin: 0; }
    .hp-detail { padding: 20px 16px; }
    .hp-d-head { flex-wrap: wrap; gap: 14px; }
    .hp-d-head .hp-avatar { width: 56px !important; height: 56px !important; }
    .hp-d-info { flex-basis: calc(100% - 70px); }
    .hp-call-again { margin-left: 70px; }
    .hp-tr-row { padding-left: 0; padding-top: 50px; }
    .hp-tr-time { top: 10px; }
    .hp-tr-who { top: 10px; left: 60px; }
    .hp-d-toggle { margin-left: 0; }
    .hp-empty { position: static; flex: 1; padding: 32px 16px; }
    .hp-empty-btn { min-width: 0; width: 100%; max-width: 320px; }
}
