/* S17 shared files page. Needs home.css, sections.css, v4.css, app.css. */
[data-shares] [hidden] { display: none !important; }
/* grid item of .ap-content: must shrink below its content so the table wrapper
   scrolls internally instead of widening the page (1024px and the like) */
[data-shares] { min-width: 0; max-width: 100%; }
/* containing block so absolutely-positioned .ap-sr helpers inside the table
   cannot escape the scroll wrapper and widen the page (1024px bug) */
[data-shares] .ap-tablewrap { position: relative; }

/* ---------- KPI sparklines with hover tooltip ---------- */
.sh-kpi { overflow: visible; }
.sh-kpi small { gap: 4px; }
.sh-info { position: relative; display: inline-grid; }
.sh-info__btn { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--text-2); cursor: pointer; }
.sh-info__btn .qq-ic { width: 13px; height: 13px; }
.sh-info__btn:hover { color: var(--text); background: var(--surface-2); }
.sh-info__tip { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 40; width: 210px; padding: 10px 12px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-size: .78rem; font-weight: 500; line-height: 1.45; display: none; }
.sh-info__btn:hover + .sh-info__tip, .sh-info__btn:focus-visible + .sh-info__tip { display: block; }

/* ---------- upload drop zone ---------- */
.sh-drop { display: grid; gap: 12px; }
.sh-dropzone { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; border-radius: 16px; border: 1.5px dashed var(--line-2); background: var(--bg-2); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.sh-dropzone:hover { border-color: var(--accent); }
.sh-dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.sh-dropzone__ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.sh-dropzone__ic .qq-ic { width: 22px; height: 22px; }
.sh-dropzone b { font-size: 1rem; }
.sh-dropzone small { color: var(--text-2); font-size: .84rem; }
.sh-dropzone small u { color: var(--accent); font-weight: 700; }
.sh-just { display: grid; gap: 8px; }
.sh-just > b { font-size: .86rem; }
.sh-just__it { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.sh-just__it b { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-just__it small { color: var(--text-2); font-size: .76rem; font-family: var(--mono); }
.sh-just__it > div:last-child { display: flex; gap: 6px; }
.sh-just__bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.sh-just__bar s { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }

/* ---------- table extras: file cell, link cell, password, statuses ---------- */
.sh-fileic { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.sh-fileic .qq-ic { width: 19px; height: 19px; }
.sh-fileic--lg { width: 52px; height: 52px; border-radius: 15px; }
.sh-fileic--lg .qq-ic { width: 25px; height: 25px; }
.sh-link { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sh-link code { flex: 1; min-width: 0; font-family: var(--mono); font-size: .76rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-copy { width: 30px; height: 30px; flex: none; }
.sh-copy .qq-ic { width: 15px; height: 15px; }
.sh-pw { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .82rem; }
.sh-pw .qq-ic { width: 15px; height: 15px; }
.qq-st--expiring::before { background: #d97706; }
.qq-st--expired::before { background: #a1a1aa; }
.qq-st--revoked::before { background: #dc2626; }
.ap-table.hide-password .ap-col-password, .ap-table.hide-expires .ap-col-expires { display: none; }

/* ---------- group by + refresh (kit toolbar additions) ---------- */
.sh-groupbtn b { font-weight: 700; }
.sh-groupbtn .qq-ic:last-child { width: 12px; height: 12px; }
.sh-grouppop { width: 200px; }
.sh-grouppop .ap-menu__it[aria-checked="true"] { font-weight: 800; }
.sh-grouppop .ap-menu__it .qq-ic:last-child { margin-left: auto; }
[data-sh-refresh].is-spin .qq-ic { animation: sh-spin .6s linear; }
@keyframes sh-spin { to { transform: rotate(360deg); } }
.sh-group { border-top: 1px solid var(--line); background: var(--surface-2); }
.sh-group:first-of-type { border-top: 0; }
.sh-group button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 16px; border: 0; background: none; font: inherit; cursor: pointer; color: var(--text); }
.sh-group button .qq-ic:first-child { width: 14px; height: 14px; color: var(--text-2); transition: transform .15s; transform: rotate(90deg); }
.sh-group button[aria-expanded="false"] .qq-ic:first-child { transform: none; }
/* the header action belongs to this page (shell header, outside the body root) */
[data-sh-new] { white-space: nowrap; }
.sh-group .qq-ic { width: 16px; height: 16px; }
.sh-group em { font-style: normal; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: var(--pill); background: var(--surface-3); color: var(--text-2); }

/* ---------- detail drawer ---------- */
.sh-drawerwrap { position: fixed; inset: 0; z-index: 90; }
.sh-overlay { position: absolute; inset: 0; background: rgba(10, 10, 10, .5); }
.sh-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); overflow-y: auto; display: grid; gap: 16px; align-content: start; padding: 22px 20px 32px; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--sh-3); animation: sh-in .25s cubic-bezier(.2, .7, .2, 1); }
@keyframes sh-in { from { transform: translateX(40px); opacity: 0; } }
.sh-drawer__x { position: absolute; right: 12px; top: 12px; }
.sh-drawer__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding-right: 36px; }
.sh-drawer__head h3 { font-size: 1.05rem; font-weight: 800; overflow-wrap: anywhere; }
.sh-drawer__head p { color: var(--text-2); font-size: .82rem; }
.sh-dlink { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg-2); }
.sh-dlink__qr { width: 96px; height: 96px; padding: 6px; border-radius: 10px; background: #fff; color: #0a0a0a; }
.sh-dlink__qr svg { display: block; width: 100%; height: 100%; }
.sh-dlink__tx { display: grid; gap: 6px; align-content: start; min-width: 0; }
.sh-dlink__tx small { color: var(--text-2); font-weight: 600; font-size: .76rem; }
.sh-dlink__tx code { font-family: var(--mono); font-size: .78rem; overflow-wrap: anywhere; }
.sh-dlink__btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-dset, .sh-dlog { display: grid; gap: 10px; }
.sh-dset > b, .sh-dlog > b { font-size: .9rem; }
.sh-log { display: grid; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.sh-log > div { display: grid; grid-template-columns: 1.2fr .8fr 1fr .8fr; gap: 8px; padding: 8px 12px; font-size: .8rem; border-top: 1px solid var(--line); }
.sh-log > div:first-child { border-top: 0; background: var(--surface-2); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }

/* ---------- share modal ---------- */
.sh-modal__box { width: min(560px, 100%); text-align: left; }
.sh-modal__box h2 { text-align: center; }
.sh-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.sh-steps li { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 6px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: .82rem; }
.sh-steps li em { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); font-style: normal; font-size: .74rem; }
.sh-steps li.is-on { background: var(--ink); color: var(--on-ink); }
.sh-steps li.is-on em { background: rgba(255, 255, 255, .2); }
.sh-steps li.is-done em { background: var(--accent); color: #fff; }
.sh-modal__box section[data-sh-step] { display: grid; gap: 12px; }
.sh-progress { display: grid; gap: 6px; }
.sh-progress i { display: block; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.sh-progress s { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.sh-progress small { color: var(--text-2); font-size: .82rem; }
.sh-err { margin: 0; color: #b91c1c; font-weight: 600; font-size: .84rem; }
.sh-field { display: grid; gap: 8px; }
.sh-field__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sh-lab { font-weight: 600; font-size: .86rem; }
.sh-passrow { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
.sh-input { display: flex; align-items: center; gap: 8px; flex: 1; min-height: 42px; padding: 0 8px 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); }
.sh-input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.sh-input .qq-ic { width: 16px; height: 16px; color: var(--text-2); flex: none; }
.sh-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--text); }
.sh-input > button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; }
.sh-input > button:hover { background: var(--surface-2); color: var(--text); }
.sh-mini { min-height: 34px; padding: 0 12px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface); font: 600 .8rem var(--font); color: var(--text); cursor: pointer; }
.sh-mini:hover { border-color: var(--ink); }
.sh-expchips { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-expchips .ap-tag span { min-height: 34px; }
.sh-wiznav { display: flex; justify-content: space-between; gap: 8px; }
.sh-dd, .sh-date { position: relative; display: grid; gap: 6px; }
.sh-dd__btn, .sh-date__btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; color: var(--text); cursor: pointer; }
.sh-dd__btn:hover, .sh-date__btn:hover { border-color: var(--ink); }
.sh-dd__btn .qq-ic, .sh-date__btn > .qq-ic { width: 15px; height: 15px; color: var(--text-2); }
.sh-dd__pop, .sh-date__pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-3); }
.sh-dd__pop button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.sh-dd__pop button:hover { background: var(--surface-2); }
.sh-dd__pop button[aria-selected="true"] { font-weight: 800; }
.sh-date__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px; }
.sh-date__head button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; }
.sh-date__head button:hover { background: var(--surface-2); }
.sh-date__head .qq-ic { width: 14px; height: 14px; }
.sh-date__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.sh-date__grid button { min-height: 32px; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--text); cursor: pointer; }
.sh-date__grid button:hover { background: var(--surface-2); }
.sh-date__grid button.is-on { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.sh-date__grid button.is-past { color: var(--text-2); opacity: .55; }
.sh-date__foot { display: flex; justify-content: space-between; padding-top: 8px; }
.sh-date__foot button { border: 0; background: none; font: 600 .82rem var(--font); color: var(--accent); cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.sh-date__foot button:hover { background: var(--accent-soft); }
.sh-doneqr { display: grid; justify-items: center; gap: 8px; }
.sh-doneqr svg { width: 150px; height: 150px; padding: 10px; border-radius: 16px; background: #fff; color: #0a0a0a; border: 1px solid var(--line); }
.sh-copyrow { display: grid; gap: 6px; }
.sh-copyrow small { font-weight: 600; font-size: .82rem; }
.sh-copyrow > div { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.sh-copyrow code { flex: 1; min-width: 0; font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; }
.sh-donemeta { margin: 0; text-align: center; color: var(--text-2); font-size: .84rem; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  [data-shares] .ap-tablewrap { overflow-x: auto; }
  [data-shares] .ap-table { min-width: 920px; }
}
@media (max-width: 640px) {
  .ap-table[data-table-id="shares"] { min-width: 0; }
  .ap-table[data-table-id="shares"] .ap-tr { grid-template-columns: 28px minmax(0, 1fr) auto auto !important; }
  .ap-table[data-table-id="shares"] .ap-col-link, .ap-table[data-table-id="shares"] .ap-col-password, .ap-table[data-table-id="shares"] .ap-col-expires, .ap-table[data-table-id="shares"] .ap-col-views, .ap-table[data-table-id="shares"] .ap-col-downloads { display: none; }
  .sh-log > div { grid-template-columns: 1.2fr .8fr 1fr; }
  .sh-log > div > span:nth-child(4) { display: none; }
  .sh-dlink { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .sh-dlink__btns { justify-content: center; }
  .sh-wiznav { flex-wrap: wrap; }
  .sh-wiznav .qq-btn { flex: 1; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .sh-drawer, [data-sh-refresh].is-spin .qq-ic { animation: none; }
}

/* ---------- U-POLISH: kit grid gap between KPI cards, drop zone and table ---------- */
[data-shares] { display: grid; gap: 16px; align-content: start; min-width: 0; }
[data-shares] > * { min-width: 0; }
.sh-kpis { gap: 12px; }

/* ---------- L-FILES: sync banner + table loading/error states ---------- */
.sh-sync { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: .86rem; }
.sh-sync__spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: sh-spin .7s linear infinite; }
[data-shares] .ap-table[data-sh-state="loading"] [data-empty], [data-shares] .ap-table[data-sh-state="loading"] [data-empty-full], [data-shares] .ap-table[data-sh-state="error"] [data-empty], [data-shares] .ap-table[data-sh-state="error"] [data-empty-full] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .sh-sync__spin { animation: none; }
}
