/* history.css — History view and the stats strip (prefix h-). SPEC §12.
   Shared classes (.panel .btn .seg .field .log .sub .num .pf) come from app.css; everything here is h-. */

/* ---------- stats strip (home + history), the four parchment tiles of the mockup ---------- */
.h-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin:0}
.h-stat{padding:12px 16px;display:flex;align-items:center;gap:14px;min-width:0}
.h-stat-ico{width:44px;height:44px;image-rendering:pixelated;image-rendering:crisp-edges;flex:none}
.h-stat-txt{min-width:0}
.h-stat-v{font-family:Silkscreen,monospace;font-size:28px;color:var(--gold);line-height:1.1;white-space:nowrap}
.h-stat-u{font-size:13px;color:var(--muted);font-family:Nunito,system-ui,sans-serif;font-weight:700}
.h-stat-k{font-size:13px;color:var(--muted)}

/* ---------- view layout ---------- */
.h-view{display:flex;flex-direction:column;gap:14px}
.h-grid{display:grid;grid-template-columns:1.45fr 1fr;gap:14px;align-items:start}
.h-hidden{display:none !important}

/* ---------- controls ---------- */
.h-controls{display:flex;align-items:center;justify-content:space-between;gap:12px 18px;padding:10px 16px;flex-wrap:wrap}
.h-seg{flex:none}
.h-nav{display:flex;align-items:center;gap:12px;flex:1 1 auto;justify-content:center;min-width:0}
.h-arrow{cursor:pointer;color:#f3e4c4;background:var(--frame);border:3px solid var(--frameD);box-shadow:inset 0 0 0 2px var(--frameL),3px 3px 0 var(--shadow);width:38px;height:38px;display:grid;place-items:center;font-size:26px;line-height:1;padding:0;flex:none;font-family:"Pixelify Sans",monospace}
.h-arrow:hover{background:var(--frameL)}
.h-arrow:active{transform:translate(2px,2px);box-shadow:inset 0 0 0 2px var(--frameL),1px 1px 0 var(--shadow)}
.h-arrow:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.h-title{display:flex;flex-direction:column;align-items:center;text-align:center;min-width:0;line-height:1.15}
.h-title-main{font-size:24px;color:var(--ink);font-weight:600}
.h-title-sub{font-size:13px;color:var(--muted);font-weight:600}
.h-pick{display:flex;align-items:center;gap:10px;flex:none}
.h-date{font-family:Silkscreen,monospace;font-size:12px;padding:7px 10px;background:var(--field);color:#2a1f22;border:3px solid var(--edge);box-shadow:inset 3px 3px 0 #e2d3b8;min-height:38px;color-scheme:light}
.h-date:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.h-today{flex:none}

/* ---------- list ---------- */
.h-list{padding:16px 18px;min-width:0}
.h-list-title{font-family:"Pixelify Sans",monospace;font-weight:600;font-size:24px;margin:0 0 8px;color:var(--ink);display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
.h-list-title small{font-family:Nunito,system-ui,sans-serif;font-size:13px;color:var(--muted);font-weight:600}
.h-list-body{display:flex;flex-direction:column;gap:14px;transition:opacity .15s}
.h-busy .h-list-body{opacity:.6}
.h-loading{padding:18px 4px}
.h-group{display:flex;flex-direction:column}
.h-day{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;padding:6px 8px 5px;background:var(--panel2);border-left:4px solid var(--gold);margin-bottom:4px}
.h-day:not(.h-day-single){cursor:pointer}
.h-day:not(.h-day-single):hover{background:var(--line)}
.h-day:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.h-day-name{font-size:19px;color:var(--ink)}
.h-day-count{font-size:13px;color:var(--muted);font-weight:700}
.h-day-stage{font-size:13px;color:var(--gold);font-weight:700;margin-left:auto;white-space:nowrap}
.h-day-stage::before{content:"✦ ";font-size:11px}
.h-rows .h-row{grid-template-columns:118px 1fr auto;cursor:pointer}
.h-rows .h-row:hover{background:rgba(255,255,255,.35)}
.h-rows .h-row:focus-visible{outline:3px solid var(--gold);outline-offset:-3px}
.h-time{display:flex;flex-direction:column;gap:2px;line-height:1.2;white-space:nowrap}
.h-city{font-family:Nunito,system-ui,sans-serif;font-size:11px;color:var(--muted);font-weight:700;text-transform:none}
.h-row-ico{width:22px;height:22px;image-rendering:pixelated;image-rendering:crisp-edges;flex:none}
.h-note{min-width:0}
.h-note-text{white-space:pre-wrap;overflow-wrap:anywhere}
.h-note-empty{color:var(--muted);font-style:italic}
.h-edit-hint{margin-top:12px;font-size:13px}
.h-empty{display:flex;align-items:center;gap:12px;padding:22px 8px;justify-content:center;text-align:center}
.h-empty-ico{width:33px;height:33px;image-rendering:pixelated;image-rendering:crisp-edges;flex:none}

/* ---------- export ---------- */
.h-export{padding:16px 18px;display:flex;flex-direction:column;gap:12px;position:sticky;top:14px}
.h-export h2{font-family:"Pixelify Sans",monospace;font-weight:600;font-size:24px;margin:0;color:var(--ink)}
.h-export-hint{margin:0;font-size:13px}
.h-export-dates{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.h-field{display:flex;flex-direction:column;gap:4px;min-width:0}
.h-field > span{font-size:13px;color:var(--muted);font-weight:700}
.h-field input{width:100%;min-width:0;color-scheme:light}
.h-check{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--ink);cursor:pointer;user-select:none}
.h-check input{width:20px;height:20px;accent-color:var(--btn);margin:0;flex:none;cursor:pointer}
.h-export-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.h-export-msg{font-size:13px;color:var(--accent);min-height:1.2em}
.h-export-msg:empty{display:none}

/* ---------- phones ---------- */
@media (max-width:860px){
  .h-stats{grid-template-columns:repeat(2,1fr);gap:10px}
  .h-stat{padding:10px 12px;gap:10px}
  .h-stat-ico{width:33px;height:33px}
  .h-stat-v{font-size:22px}
  .h-grid{grid-template-columns:1fr}
  .h-export{position:static}
  .h-controls{justify-content:center}
  .h-nav{order:-1;width:100%}
  .h-pick{width:100%;justify-content:center}
  .h-date{flex:1 1 auto;min-width:0}
  .h-rows .h-row{grid-template-columns:96px 1fr auto}
  .h-time{font-size:11px}
}
@media (max-width:420px){
  .h-rows .h-row{grid-template-columns:1fr auto}
  .h-rows .h-row .h-note{grid-column:1 / -1;order:1}
  .h-rows .h-row .h-dur{order:2}
  .h-rows .h-row .h-time{order:0}
  .h-day-stage{margin-left:0}
}
