/* Share links (static/share.js, blueprints/share.py): the header button,
   its link menu, the new/edit dialog and the delete confirm for internal
   users; the read-only chrome of a shared forecast link. Built on the app's
   panel/line/fg tokens so both themes follow; blue is the one accent. */
:root { --sh-blue: #4f7be8; --sh-green: #1f8a4c; --sh-red: #c2413a; }

/* ── Header button ─────────────────────────────────────────────────────── */
.share-anchor { position: relative; display: inline-flex; }
.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 9px 0 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; line-height: 16px; white-space: nowrap;
  color: var(--fg); background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; transition: background .15s, box-shadow .15s;
}
.share-btn svg { width: 14px; height: 14px; flex: none; }
.share-btn .share-chev { width: 13px; height: 13px; color: var(--fg-dim); }
.share-btn:hover { background: var(--panel-3); }
.share-btn[aria-expanded="true"] { background: var(--panel); box-shadow: 0 0 0 2px rgba(79, 123, 232, .55); }
.share-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff; background: var(--sh-blue);
}
.share-count[hidden] { display: none; }

/* ── Link menu ─────────────────────────────────────────────────────────── */
.share-menu {
  position: fixed; z-index: 60; width: 460px;
  max-height: min(640px, calc(100vh / var(--zf, 1) - 90px)); display: flex; flex-direction: column;
  background: var(--panel); color: var(--fg);
  border: .5px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28), 0 2px 6px rgba(0, 0, 0, .12);
  text-align: left; font-size: 13px;
}
[data-theme="light"] .share-menu { background: #fcfbf9; box-shadow: 0 18px 48px rgba(40, 34, 24, .16), 0 2px 6px rgba(40, 34, 24, .08); }
.share-menu-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px; border-bottom: .5px solid var(--line);
}
.share-menu-head h3 { font-size: 14px; font-weight: 600; margin: 0; }
.share-menu-list { overflow-y: auto; }
.share-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border-radius: 7px; border: 0; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: #1a1815; color: #fff;
}
html:not([data-theme="light"]) .share-pill { background: var(--grn); color: var(--accent-ink); }
.share-pill:disabled { opacity: .55; cursor: default; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 13px 16px; border-bottom: .5px solid var(--line); }
.share-row:last-child { border-bottom: 0; }
.share-row--expired .share-row-name, .share-row--expired .share-row-sub { color: var(--fg-faint); }
.share-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.share-row-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-chip { font-size: 10px; font-weight: 600; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; }
.share-chip--active { color: var(--sh-green); background: rgba(31, 138, 76, .12); }
.share-chip--expired { color: var(--sh-red); background: rgba(194, 65, 58, .12); }
.share-row-sub { grid-column: 1; color: var(--fg-dim); font-size: 12px; }
.share-row-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--fg-dim); font-size: 12px; }
.share-row-meta span { display: inline-flex; align-items: center; gap: 4px; }
.share-row-meta svg { width: 12px; height: 12px; }
.share-row-seen { grid-column: 1; font-size: 12px; font-weight: 500; color: var(--fg); }
.share-row-actions { grid-column: 2; grid-row: 1 / span 4; align-self: center; display: flex; gap: 6px; }
.share-icon-btn {
  width: 28px; height: 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer;
}
.share-icon-btn svg { width: 14px; height: 14px; }
.share-icon-btn:hover { background: var(--panel-2); }
.share-icon-btn--copy { color: var(--sh-blue); border-color: rgba(79, 123, 232, .6); }
.share-url {
  grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; margin-top: 4px;
  padding: 6px 9px; border-radius: 6px; background: var(--panel-2);
  font: 12px/16px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg-dim);
}
.share-url span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-url-count { font-family: inherit; white-space: nowrap; color: var(--fg-faint); }
.share-url-count--off { color: var(--sh-red); }
.share-menu-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 11px 16px;
  border-top: .5px solid var(--line); color: var(--fg-faint); font-size: 11.5px; line-height: 15px;
}
.share-empty { padding: 26px 16px; text-align: center; color: var(--fg-dim); display: grid; gap: 12px; justify-items: center; }
.share-msg { padding: 14px 16px; color: var(--fg-dim); }

/* ── Dialogs ───────────────────────────────────────────────────────────── */
.share-dialog {
  width: 620px; max-width: calc(100vw / var(--zf, 1) - 32px); max-height: calc(100vh / var(--zf, 1) - 48px);
  padding: 0; border: .5px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--fg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
[data-theme="light"] .share-dialog { background: #fcfbf9; }
.share-dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(2px); }
.share-dialog[open] { display: flex; flex-direction: column; }
.share-dialog form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.share-dlg-head { padding: 18px 22px 14px; border-bottom: .5px solid var(--line); position: relative; }
.share-dlg-head h2 { font-size: 17px; font-weight: 600; margin: 0 0 4px; padding-right: 28px; }
.share-dlg-head p { margin: 0; font-size: 13px; color: var(--fg-dim); line-height: 18px; }
.share-x { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--fg-dim); cursor: pointer; font-size: 18px; }
.share-x:hover { background: var(--panel-2); color: var(--fg); }
.share-dlg-body { overflow-y: auto; padding: 16px 22px 18px; flex: 1; min-height: 0; }
.share-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-dim); margin: 0 0 6px; }
.share-field {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
.share-field:focus-within { border-color: var(--sh-blue); box-shadow: 0 0 0 3px rgba(79, 123, 232, .18); }
.share-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); font-size: 14px; box-shadow: none !important; }
.share-field svg { width: 14px; height: 14px; color: var(--fg-dim); flex: none; }
.share-field-hint { font-size: 12px; color: var(--fg-faint); white-space: nowrap; }
.share-field-btn { border: 0; background: none; color: var(--sh-blue); font-size: 12px; cursor: pointer; padding: 0; }
.share-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
/* Passcode reveal (menu row and edit dialog). */
.share-reveal { display: inline-flex; align-items: center; gap: 4px; }
.share-reveal .share-reveal-btn { width: 20px; height: 20px; border: 0; background: none; color: var(--fg-dim); border-radius: 5px; }
.share-reveal .share-reveal-btn svg { width: 13px; height: 13px; }
.share-reveal .share-reveal-btn:hover:not(:disabled) { background: var(--panel-2); color: var(--fg); }
.share-reveal .share-reveal-btn:disabled { opacity: .4; cursor: not-allowed; }
.share-reveal-code { font: 12px/16px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg); user-select: all; }
/* Expiry: a field-shaped button and its calendar (share.js expiryPicker). */
.share-date { width: 100%; font: inherit; color: var(--fg); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.share-date:hover { border-color: var(--fg-faint); }
.share-date:focus-visible, .share-date[aria-expanded="true"] { outline: 0; border-color: var(--sh-blue); box-shadow: 0 0 0 3px rgba(79, 123, 232, .18); }
.share-date-text { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-date.is-empty .share-date-text { color: var(--fg-dim); }
.share-cal {
  position: fixed; z-index: 5; box-sizing: border-box; width: 300px; padding: 12px; border-radius: 12px;
  background: var(--panel); border: .5px solid var(--line); color: var(--fg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28); transform-origin: top left;
  animation: share-cal-in .14s ease-out;
}
[data-theme="light"] .share-cal { background: #fff; }
.share-cal.is-above { transform-origin: bottom left; }
@keyframes share-cal-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.share-cal-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: .5px solid var(--line); }
.share-cal-chip {
  height: 26px; padding: 0 8px; border-radius: 999px; white-space: nowrap; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); transition: background .12s, border-color .12s;
}
.share-cal-chip:hover { border-color: var(--sh-blue); }
.share-cal-chip.is-on { background: var(--sh-blue); border-color: var(--sh-blue); color: #fff; }
.share-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.share-cal-title { font-size: 13.5px; font-weight: 600; }
.share-cal-nav.share-icon-btn { width: 26px; height: 26px; border: 0; background: none; }
.share-cal-nav.share-icon-btn:hover:not(:disabled) { background: var(--panel-2); }
.share-cal-nav:disabled { opacity: .3; cursor: default; }
.share-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.share-cal-grid--next { animation: share-cal-next .16s ease-out; }
.share-cal-grid--prev { animation: share-cal-prev .16s ease-out; }
@keyframes share-cal-next { from { opacity: .3; transform: translateX(10px); } }
@keyframes share-cal-prev { from { opacity: .3; transform: translateX(-10px); } }
.share-cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--fg-faint); padding: 4px 0; }
.share-cal-day {
  height: 32px; border: 0; border-radius: 8px; background: none; color: var(--fg);
  font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; transition: background .1s;
}
.share-cal-day:hover:not(:disabled) { background: var(--panel-2); }
.share-cal-day:focus-visible { outline: 2px solid var(--sh-blue); outline-offset: -2px; }
.share-cal-day.is-out { color: var(--fg-faint); }
.share-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--sh-blue); font-weight: 600; }
.share-cal-day.is-on, .share-cal-day.is-on:hover { background: var(--sh-blue); color: #fff; font-weight: 600; }
.share-cal-day:disabled { color: var(--fg-faint); opacity: .4; cursor: default; }
.share-cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: .5px solid var(--line); font-size: 11.5px; color: var(--fg-dim); }
@media (prefers-reduced-motion: reduce) { .share-cal, .share-cal-grid--next, .share-cal-grid--prev { animation: none; } }
.share-pc-set { display: flex; align-items: center; gap: 8px; height: 38px; font-size: 13px; color: var(--fg-dim); }
.share-err { margin: 12px 0 0; font-size: 12.5px; color: var(--sh-red); }
.share-err:empty { display: none; }
.share-tree { margin-top: 18px; }
.share-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 0 8px calc(var(--depth, 0) * 18px); border-bottom: .5px solid var(--line);
}
.share-toggle-row:last-child { border-bottom: 0; }
.share-toggle-row[data-depth="0"] .share-t-label { font-weight: 600; }
.share-t-label { font-size: 13.5px; }
.share-t-help { display: block; font-size: 12px; color: var(--fg-dim); margin-top: 1px; }
.share-toggle-row.is-off-parent { opacity: .45; }
.share-switch { position: relative; width: 30px; height: 18px; flex: none; }
.share-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.share-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--panel-3); transition: background .15s; pointer-events: none; }
.share-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.share-switch input:checked + span { background: var(--sh-blue); }
.share-switch input:checked + span::after { transform: translateX(12px); }
.share-switch input:disabled { cursor: default; }
.share-switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(79, 123, 232, .3); }
.share-always { margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); font-size: 13px; }
.share-always ul { margin: 6px 0 8px 18px; padding: 0; list-style: disc; display: grid; gap: 3px; }
.share-always b { font-weight: 600; }
.share-always p { margin: 0; font-size: 12px; color: var(--fg-dim); }
.share-dlg-foot {
  display: flex; align-items: center; gap: 12px; padding: 13px 22px;
  border-top: .5px solid var(--line);
}
.share-dlg-foot p { flex: 1; margin: 0; font-size: 12px; color: var(--fg-dim); line-height: 16px; }
.share-btn2 { height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
.share-btn2:hover { background: var(--panel-2); }
.share-btn2--primary { border-color: transparent; background: #1a1815; color: #fff; display: inline-flex; align-items: center; gap: 7px; }
html:not([data-theme="light"]) .share-btn2--primary { background: var(--grn); color: var(--accent-ink); }
.share-btn2--primary:hover { background: #000; }
html:not([data-theme="light"]) .share-btn2--primary:hover { background: #fff; }
.share-btn2--primary svg { width: 15px; height: 15px; }
.share-btn2--danger { color: var(--sh-red); border-color: rgba(194, 65, 58, .55); }
.share-btn2--danger-solid { background: var(--sh-red); border-color: var(--sh-red); color: #fff; }
.share-btn2:disabled { opacity: .55; cursor: default; }
.share-confirm { width: 440px; }
.share-confirm .share-dlg-body p { margin: 0; font-size: 13.5px; line-height: 19px; }
.share-toast {
  position: fixed; z-index: 80; left: 50%; bottom: 28px; transform: translateX(-50%);
  padding: 9px 14px; border-radius: 9px; background: #1a1815; color: #fff; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}

/* ── A shared forecast link (html[data-share]) ─────────────────────────── */
.hdr-brand--static { font-size: 13px; font-weight: 600; padding: 5px 2px; }
.share-ro-chip {
  font-size: 11.5px; color: var(--fg-dim); padding: 3px 8px; border-radius: 999px;
  background: var(--panel-2); border: .5px solid var(--line); white-space: nowrap;
}
/* Inputs show their values, disabled (share.js), styled exactly as they
   are for Kynship: only no focus ring, tooltips kept, and the "not allowed"
   pointer. Spreadsheet cells (.mn-input) are read-only, not disabled, and
   keep the Kynship look whole: selection ring, block wash, cell pointer. */
html[data-share] [data-share-ro]:disabled { opacity: 1; cursor: not-allowed !important; box-shadow: none !important; outline: none !important; }
/* Links to a page this link cannot open (share.js). */
html[data-share] a[data-share-off] { display: none !important; }
/* Save, discard, revert and reset controls are removed. */
html[data-share] :is(.mn-save, .mn-discard, .mn-actions, .mn-chip, .mn-fx-note, .am-save,
  .eh-revert, .st-save:not([data-share-save]), .st-edited, .cod-set-save, .cod-set-reset, .pt-reset,
  .reload-btn, #reload-btn, [data-reset], .eh-chip) { display: none !important; }

/* ── Viewer gate: inactive link, passcode, too many tries ──────────────── */
.share-gate-main { min-height: calc(100vh / var(--zf, 1)); display: flex; align-items: center; justify-content: center; padding: 20px; }
.share-gate {
  width: 380px; max-width: 100%; padding: 28px 28px 26px; border-radius: 14px;
  background: var(--panel); border: .5px solid var(--line); text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .18);
}
.share-gate h1 { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.share-gate p { margin: 0; font-size: 13.5px; color: var(--fg-dim); }
.share-gate-brand { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 8px; }
.share-gate-form { margin-top: 18px; text-align: left; display: grid; gap: 8px; }
.share-gate-form .share-btn2 { justify-content: center; margin-top: 6px; }
