/* ==========================================================================
   Experiment 03 · Ghost mode (experiments/ghost-mode/).
   An enterprise calendar in light mode. The assistant's proposed changes
   appear as translucent ghosts over the real week before anything changes.
   Hold a ghost to approve it, flick it away to reject it, peel a strip to
   undo. Skin: enterprise light (white surface, one blue, system sans).
   Motion: transform/opacity; reduced motion = instant states, no peel.
   ========================================================================== */

.gm { grid-column: 1 / 13; --gm-bg: #F4F6F9; --gm-sur: #FFFFFF; --gm-ink: #161616; --gm-mute: #6F6F6F; --gm-line: #E0E4EA; --gm-blue: #0F62FE; --gm-blue-dk: #0043CE; --gm-blue-soft: rgba(15,98,254,.10); --gm-red: #DA1E28; --gm-green: #24A148; --gm-amber: #F1C21B;
  font-family: var(--sans); color: var(--gm-ink); background: var(--gm-bg); border-radius: 16px; overflow: hidden; border: 1px solid rgba(245,242,235,.12); box-shadow: 0 30px 80px rgba(0,0,0,.45); display: grid; grid-template-columns: minmax(0, 1fr) 272px; grid-template-rows: auto minmax(0, 1fr); }
.gm *, .gm *::before, .gm *::after { box-sizing: border-box; }
.gm button { font: inherit; cursor: pointer; }
.gm button:focus-visible { outline: 2px solid var(--gm-blue); outline-offset: 2px; }

/* ---------- top bar ---------- */
.gm-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--gm-sur); border-bottom: 1px solid var(--gm-line); font-size: 13px; }
.gm-bar .app { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.gm-bar .app i { width: 22px; height: 22px; border-radius: 6px; background: var(--gm-blue); display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.gm-bar .week { color: var(--gm-mute); display: flex; align-items: center; gap: 8px; }
.gm-bar .week b { color: var(--gm-ink); font-weight: 500; }
.gm-bar .week button { width: 24px; height: 24px; border: 1px solid var(--gm-line); background: #fff; border-radius: 4px; color: var(--gm-mute); font-size: 12px; }
.gm-bar .spacer { flex: 1; }
.gm-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--gm-blue-soft); color: var(--gm-blue-dk); font-weight: 500; font-size: 12.5px; border: 1px solid rgba(15,98,254,.18); }
.gm-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--gm-blue); }
.gm-pill b { font-weight: 600; font-variant-numeric: tabular-nums; }
.gm-pill.is-done { background: #DEFBE6; color: #0E6027; border-color: #A7F0BA; }
.gm-pill.is-done i { background: var(--gm-green); }
.gm-bar .avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #FFB3C7, #C31537); }

/* ---------- calendar ---------- */
.gm-cal { position: relative; display: grid; grid-template-columns: 56px repeat(5, minmax(0, 1fr)); grid-template-rows: 40px minmax(0, 1fr); background: var(--gm-sur); min-height: 520px; }
.gm-cal .corner { border-bottom: 1px solid var(--gm-line); border-right: 1px solid var(--gm-line); }
.gm-cal .dayh { border-bottom: 1px solid var(--gm-line); border-right: 1px solid var(--gm-line); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--gm-mute); text-transform: uppercase; letter-spacing: .06em; }
.gm-cal .dayh b { font-size: 15px; letter-spacing: 0; color: var(--gm-ink); font-weight: 600; text-transform: none; }
.gm-cal .dayh.today b { background: var(--gm-blue); color: #fff; border-radius: 999px; width: 26px; height: 26px; display: grid; place-items: center; }
.gm-cal .hours { border-right: 1px solid var(--gm-line); position: relative; }
.gm-cal .hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--gm-mute); font-variant-numeric: tabular-nums; }
.gm-cal .day { position: relative; border-right: 1px solid var(--gm-line); background-image: linear-gradient(var(--gm-line) 1px, transparent 1px); background-size: 100% calc(100% / 9); }
.gm-cal .day:last-child, .gm-cal .dayh:last-child { border-right: 0; }
/* an event: top/height are percentages of the 9-hour day (9:00–18:00), set inline */
.gm-ev { position: absolute; left: 6px; right: 6px; border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; background: #E8F0FE; color: var(--gm-blue-dk); border-left: 3px solid var(--gm-blue); transition: opacity .3s, transform .3s, background .3s, border-color .3s, top .35s cubic-bezier(.2,.8,.2,1), height .35s cubic-bezier(.2,.8,.2,1); }
.gm-ev b { display: block; font-weight: 600; }
.gm-ev small { display: block; font-size: 11px; opacity: .8; margin-top: 2px; }
.gm-ev.gray { background: #F0F0F0; color: #4A4A4A; border-left-color: #A8A8A8; }
.gm-ev.green { background: #DEFBE6; color: #0E6027; border-left-color: var(--gm-green); }
.gm-ev.is-from { opacity: .35; }
.gm-ev.is-gone { opacity: 0; transform: scale(.96); pointer-events: none; }
.gm-ev .mark { position: absolute; top: 6px; right: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--gm-blue); color: #fff; font-size: 9px; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .3s; }
.gm-ev.is-changed .mark { opacity: 1; transform: none; }
.gm-ev.declined { text-decoration: line-through; opacity: .55; }

/* ghosts: the proposal, over the calendar */
.gm-ghost { position: absolute; left: 6px; right: 6px; border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.3; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  background: rgba(15,98,254,.10); color: var(--gm-blue-dk); border: 1.5px dashed rgba(15,98,254,.7); backdrop-filter: blur(1px);
  box-shadow: 0 6px 18px rgba(15,98,254,.12); transition: opacity .3s, transform .3s, box-shadow .2s; z-index: 3; }
.gm-ghost b { display: block; font-weight: 600; }
.gm-ghost small { display: block; font-size: 11px; opacity: .85; margin-top: 2px; }
.gm-ghost .kind { position: absolute; top: -9px; left: 8px; background: var(--gm-blue); color: #fff; font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 999px; }
.gm-ghost.decline { background: #FFF1F1; border-color: rgba(218,30,40,.6); color: #A2191F; }
.gm-ghost.decline .kind { background: var(--gm-red); }
.gm-ghost.is-focus, .gm-ghost:hover { box-shadow: 0 10px 28px rgba(15,98,254,.22); z-index: 5; }
.gm-ghost.is-holding { cursor: grabbing; }
.gm-ghost.is-dragging { transition: none; cursor: grabbing; z-index: 6; }
.gm-ghost.is-approved { opacity: 0; transform: scale(1.04); pointer-events: none; }
.gm-ghost.is-rejected { opacity: 0; transform: translateX(var(--fx, 160px)) rotate(var(--fr, 6deg)); pointer-events: none; transition: opacity .35s, transform .35s cubic-bezier(.2,.8,.2,1); }
/* hold-to-approve progress ring in the corner of the ghost */
.gm-ghost .hold { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; }
.gm-ghost .hold circle { fill: none; stroke-width: 2.5; }
.gm-ghost .hold .t { stroke: rgba(15,98,254,.18); }
.gm-ghost .hold .p { stroke: var(--gm-blue); stroke-linecap: round; stroke-dasharray: 56.5; stroke-dashoffset: 56.5; }
.gm-ghost.is-holding .hold .p { transition: stroke-dashoffset var(--hold, 650ms) linear; stroke-dashoffset: 0; }
.gm-ghost.decline .hold .p { stroke: var(--gm-red); }
/* connector from the original to the ghost */
.gm-link { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: visible; }
.gm-link path { fill: none; stroke: var(--gm-blue); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .7; transition: opacity .3s; }
.gm-link path.off { opacity: 0; }
.gm-link .arrow { fill: var(--gm-blue); transition: opacity .3s; }
.gm-link .arrow.off { opacity: 0; }

/* the reason card, above or below a ghost */
.gm-why { position: absolute; z-index: 8; width: 250px; background: var(--gm-ink); color: #fff; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 16px 40px rgba(0,0,0,.28); opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .18s, transform .18s; }
.gm-why.on { opacity: 1; transform: none; pointer-events: auto; }
.gm-why small { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #A8A8A8; margin-bottom: 4px; }
.gm-why .acts { display: flex; gap: 8px; margin-top: 10px; }
.gm-why .acts button { height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; font-size: 12px; font-weight: 500; }
.gm-why .acts button.ok { background: var(--gm-blue); border-color: var(--gm-blue); }
.gm-why .acts button:hover { filter: brightness(1.15); }
.gm-why .hint { margin-top: 8px; font-size: 11px; color: #A8A8A8; }
.gm-why::before { content: ""; position: absolute; left: 20px; top: -5px; width: 10px; height: 10px; background: var(--gm-ink); transform: rotate(45deg); border-radius: 2px; }
.gm-why.below::before { top: auto; bottom: -5px; }

/* ---------- side rail: the changes ---------- */
.gm-rail { background: var(--gm-bg); border-left: 1px solid var(--gm-line); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.gm-rail h4 { margin: 0; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.gm-rail h4 span { font-weight: 400; color: var(--gm-mute); font-variant-numeric: tabular-nums; }
.gm-rail .pending { display: flex; flex-direction: column; gap: 8px; }
.gm-prop { text-align: left; background: var(--gm-sur); border: 1px solid var(--gm-line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; line-height: 1.4; cursor: pointer; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; transition: border-color .2s, opacity .3s, transform .3s; }
.gm-prop:hover, .gm-prop.is-focus { border-color: var(--gm-blue); }
.gm-prop i { width: 18px; height: 18px; border-radius: 4px; border: 1.5px dashed var(--gm-blue); margin-top: 1px; }
.gm-prop.decline i { border-color: var(--gm-red); }
.gm-prop b { display: block; font-weight: 600; }
.gm-prop small { display: block; color: var(--gm-mute); font-size: 11.5px; margin-top: 2px; }
.gm-prop.is-out { opacity: 0; transform: translateX(12px); height: 0; padding: 0; margin: -8px 0 0; overflow: hidden; border: 0; }
.gm-rail .all { display: flex; gap: 8px; }
.gm-rail .all button { flex: 1; height: 34px; border-radius: 6px; border: 1px solid var(--gm-line); background: var(--gm-sur); font-size: 12.5px; font-weight: 500; color: var(--gm-ink); position: relative; overflow: hidden; }
.gm-rail .all button.ok { background: var(--gm-blue); border-color: var(--gm-blue); color: #fff; }
.gm-rail .all button.ok::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.28); }
.gm-rail .all button.ok.is-holding::after { width: 100%; transition: width var(--hold, 900ms) linear; }
.gm-rail .all button:disabled { opacity: .45; cursor: default; }
.gm-rail .empty { font-size: 12px; color: var(--gm-mute); padding: 6px 2px; }
/* the undo stack: strips of tape, newest on top */
.gm-done { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.gm-tape { position: relative; border: 0; width: 100%; text-align: left; background: #FFF3C4; color: #5C4800; border-radius: 2px; padding: 8px 10px 8px 30px; font-size: 12px; line-height: 1.35; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.12); transform: rotate(var(--r, -.6deg)); transform-origin: left center; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s; }
.gm-tape::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(0,0,0,.025) 6px 7px); border-radius: inherit; pointer-events: none; }
.gm-tape::after { content: "↶"; position: absolute; left: 9px; top: 7px; font-size: 13px; color: #8A6D00; }
.gm-tape b { font-weight: 600; }
.gm-tape small { display: block; font-size: 10.5px; color: #8A6D00; margin-top: 2px; }
.gm-tape:hover { transform: rotate(0) translateX(2px); }
.gm-tape.peel { transform: rotate(-14deg) translate(18px, -6px) scale(.96); opacity: 0; }

.gm-reset { margin-top: auto; height: 34px; border-radius: 6px; border: 1px solid var(--gm-line); background: var(--gm-sur); font-size: 12.5px; font-weight: 500; color: var(--gm-mute); }
.gm-reset:hover { color: var(--gm-ink); border-color: #C6C6C6; }

/* ---------- key under the instrument ---------- */
.gm-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 18px; background: var(--gm-sur); border-top: 1px solid var(--gm-line); font-size: 11.5px; color: var(--gm-mute); }
.gm-foot span b { color: var(--gm-ink); font-weight: 600; }
.gm-foot kbd { font: inherit; font-size: 11px; border: 1px solid var(--gm-line); border-radius: 4px; padding: 0 5px; color: var(--gm-ink); background: #fff; }

@media (max-width: 1000px) {
  .gm { grid-template-columns: minmax(0, 1fr); }
  .gm-bar { flex-wrap: wrap; }
  .gm-bar .spacer { display: none; }
  .gm-pill { margin-left: auto; }
  .gm-rail { border-left: 0; border-top: 1px solid var(--gm-line); }
}
@media (max-width: 700px) {
  .gm-cal { grid-template-columns: 44px repeat(5, minmax(0, 1fr)); min-height: 440px; }
  .gm-ev, .gm-ghost { font-size: 10.5px; padding: 4px 5px; left: 3px; right: 3px; }
  .gm-ev small, .gm-ghost small { display: none; }
  .gm-ghost .kind { display: none; }
  .gm-why { width: 220px; }
  .gm-bar .week span.l { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gm *, .gm *::after, .gm *::before { transition: none !important; animation: none !important; }
  .gm-ghost.is-rejected { transform: none; }
  .gm-tape.peel { transform: none; }
}
