/* Desktop home visual layer. DOM and interaction contracts remain unchanged. */
body { background: var(--bg-primary); }

/* The topbar, brand and primary nav intentionally use the shared frontend-redesign
   component so every public page renders the same header. Only home-only widgets
   (donation button, service status) get page-specific styling below. */
.topbar .donation-button { margin-right: 0; border: 0; border-radius: 10px; background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.topbar .donation-button:hover { background: var(--brand); color: #fff; }
.service-status { color: var(--text-secondary); }

/* Align the home container with help/submit/error pages (1240px + 64px gutters). */
.page-content {
  width: min(1240px, calc(100% - 64px));
  padding: 24px 0 72px;
}

.workspace-grid {
  position: relative;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  min-height: calc(100vh - 172px);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

/* Announcements live in normal document flow above the workspace. Only one item
   is visible at a time (app.js switches slides), so the bar keeps a single-card
   height no matter how many announcements the admin publishes. */
.announcement-bar {
  position: static;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  /* No grid gap: the switcher carries its own margin so a hidden switcher leaves
     the announcement card at full width. */
  gap: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
}

.announcement-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}
.announcement-nav-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-radius: 10px;
  color: var(--warning);
  background: var(--warning-soft);
}
.announcement-nav-button:hover {
  border-color: color-mix(in srgb, var(--warning) 55%, transparent);
  background: color-mix(in srgb, var(--warning) 16%, var(--bg-secondary));
}
.announcement-nav-button .ui-icon { width: 18px; height: 18px; }
.announcement-nav-counter {
  min-width: 44px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Announcement items use a warm notice treatment (amber) so they read as site
   notices at a glance instead of blending into the white cards and teal brand
   UI around them. Icon, title and links carry the accent; body text stays
   neutral for readability. */
.announcement-items { gap: 8px; border-top: 0; }
.announcement-item {
  min-height: 56px;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 1px solid color-mix(in srgb, var(--warning) 34%, transparent);
  border-radius: 14px;
  background: var(--warning-soft);
  box-shadow: none;
}
.announcement-item:last-child { border-bottom: 1px solid color-mix(in srgb, var(--warning) 34%, transparent); }
.announcement-bar-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 15%, transparent);
}
.announcement-bar-icon .ui-icon { width: 18px; height: 18px; }
.announcement-bar-title {
  display: block;
  margin: 0 0 2px;
  color: var(--warning);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
}
.announcement-bar-content {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}
.announcement-bar-content a { color: var(--warning); font-weight: 700; }

.results-panel,
.share-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-card);
}

.results-panel { overflow: hidden; }

.discovery-toolbar {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.account-toolbar { align-items: center; gap: 10px; }
.account-toolbar-icon { width: 36px; height: 36px; border-radius: 10px; color: var(--brand); background: var(--brand-soft); }
.account-select { gap: 3px; }
.account-select-label { color: var(--text-secondary); font-size: 12px; }
.account-select select { min-height: 36px; padding-inline: 0 22px; border: 0; background-color: transparent; font-size: 14px; font-weight: 700; }

.search-form { grid-template-columns: minmax(220px, 1fr) 124px 92px 44px; gap: 10px; }
.search-input-wrap input,
.filter-select select,
.sort-select select,
.password-row input,
.link-field input {
  min-height: 44px;
  border-color: var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
}
.search-input-wrap input:focus,
.filter-select select:focus,
.sort-select select:focus,
.password-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); outline: 0; }
.search-submit { min-height: 44px; border-radius: 10px; }
.toolbar-secondary .icon-button { width: 44px; height: 44px; border-radius: 10px; }

.results-heading {
  min-height: 96px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.browser-nav { margin-bottom: 8px; }
.browser-path { color: var(--text-secondary); }
.results-heading h2 { margin-bottom: 4px; font-size: 20px; }
.muted-text { color: var(--text-secondary); }
.results-actions { gap: 8px; }
.sort-select select { min-width: 124px; }
.results-actions .button-quiet { min-height: 44px; border-radius: 10px; }
/* Sort and select-all have nothing to act on without rows, so the empty and error
   states hide the whole group (setResultState writes data-result-state). */
.results-panel[data-result-state="empty"] .results-actions,
.results-panel[data-result-state="error"] .results-actions { display: none; }

.table-wrap { min-height: 520px; border-top: 0; }
.results-table { min-width: 700px; }
.results-table th { height: 48px; padding: 0 16px; color: var(--text-secondary); background: var(--bg-primary); font-size: 12px; }
.results-table td { height: 72px; padding: 12px 16px; border-bottom-color: var(--border); }
.results-table td:first-child, .results-table th:first-child { padding-left: 24px; }
.results-table td:last-child, .results-table th:last-child { padding-right: 24px; }
.results-table tbody tr { transition: background-color .2s ease, box-shadow .2s ease; }
.results-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, var(--bg-secondary)); }
.results-table tbody tr.is-selected { background: #CCFBF1; box-shadow: inset 4px 0 0 var(--brand); }
[data-theme="dark"] .results-table tbody tr.is-selected { background: var(--brand-soft); }

.row-check {
  appearance: none;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary) no-repeat center / 12px 12px;
  accent-color: var(--brand);
}
.row-check:checked {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8 3 3 7-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.row-check:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.file-name { font-size: 14px; }
.file-path { color: var(--text-secondary); }
.file-icon { width: 40px; height: 40px; border-radius: 10px; }

.share-panel {
  position: sticky;
  top: 88px;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: 600px;
  max-height: calc(100vh - 112px);
  padding: 24px;
  overflow-y: auto;
}
.share-panel-header { min-height: 44px; padding: 0 0 16px; border-bottom: 1px solid var(--border); }
.share-panel h2 { margin: 0; font-size: 20px; }
.share-title-icon { display: inline-grid; width: 24px; height: 24px; place-items: center; color: var(--brand); }
.share-title-icon .ui-icon { width: 22px; height: 22px; }
.count-badge { min-height: 28px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); }
.share-account { min-height: 52px; margin: 0; padding: 14px 0; border-bottom-color: var(--border); }
/* The empty state stretches to the panel's full height so the idle panel reads as
   a filled column instead of a short block above a large blank area. */
.selection-empty { flex: 1; min-height: 220px; justify-content: center; }
.selection-empty .state-icon { width: 44px; height: 44px; }
.selection-empty strong { font-size: 16px; }
.selection-empty-hint { color: var(--text-faint); font-size: 12px; }

.share-steps {
  display: grid;
  gap: 8px;
  width: min(100%, 260px);
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
  text-align: left;
}
.share-steps li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.share-step-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.selection-preview { padding: 12px; margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-primary); }
.selection-preview-topline { min-height: 32px; }
.selection-list { gap: 6px; }
.selection-list li { min-height: 40px; border-left: 0; border-radius: 8px; background: var(--bg-secondary); }

.share-form { padding-top: 20px; }
.share-form fieldset { margin-bottom: 22px; }
.share-form legend { margin-bottom: 10px; font-size: 14px; }
.segmented-control { gap: 4px; padding: 4px; border: 0; border-radius: 10px; background: var(--bg-primary); }
.segmented-control span { min-height: 40px; border-radius: 8px; }
.segmented-control input:checked + span { color: #fff; background: var(--brand); }
.toggle-row { min-height: 40px; gap: 10px; }
.toggle { width: 42px; height: 24px; border: 0; background: var(--border); }
.toggle::after { width: 18px; height: 18px; background: #fff; }
.toggle-row input:checked + .toggle { background: var(--brand); }
.toggle-row input:checked + .toggle::after { transform: translateX(18px); }
.password-row { margin-top: 10px; }
.create-share, .share-form .button-wide { min-height: 48px; border-radius: 10px; box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 22%, transparent); }

.share-result { padding-top: 20px; border-top: 1px solid var(--border); }
.result-success-heading { padding: 12px; margin-bottom: 12px; border-radius: 10px; background: var(--success-soft); }
.link-field input { background: var(--bg-primary); }
.link-field .button { min-height: 44px; border-radius: 10px; }
.share-qr { gap: 10px; }
.share-qr-image { width: 160px; height: 160px; border-radius: 12px; }
.password-output { border-radius: 10px; }
.share-result-actions { gap: 8px; }
.open-share-link, #newShare { min-height: 44px; border-radius: 10px; }

.live-stats {
  right: 24px;
  bottom: 24px;
  left: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-float);
}
/* Icon chips give the pill the same structure as the other cards, and the label
   colour is lifted off --text-faint so the numbers stay readable at a glance. */
.live-stat {
  grid-template-columns: 30px auto;
  column-gap: 10px;
  min-width: 124px;
  padding: 12px 16px;
}
.live-stat .ui-icon {
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 9px;
  color: var(--brand);
  background: var(--brand-soft);
}
.live-stat strong { font-size: 16px; }
.live-stat small { color: var(--text-secondary); font-size: 11px; }

/* A missing netdisk account is a setup step, not an outage: the topbar badge
   turns amber instead of red, and the detailed guidance lives in the notice
   above the results. */
.service-status.is-notice { color: var(--warning); }
.service-status.is-notice .status-dot { background: var(--warning); }

.site-footer {
  justify-content: safe center;
  text-align: center;
}
.site-footer .footer-copy {
  align-items: center;
  justify-content: safe center;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: max-content;
  text-align: center;
}
.site-footer { overflow-x: auto; scrollbar-width: none; }
.site-footer::-webkit-scrollbar { display: none; }
.site-footer .footer-copy a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 940px) {
  .site-footer { flex-direction: row; align-items: center; }
}

@media (max-width: 1180px) {
  .page-content { width: calc(100% - 32px); }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 336px; gap: 16px; }
  .discovery-toolbar { grid-template-columns: 220px minmax(0, 1fr); padding-inline: 20px; }
  .search-form { grid-template-columns: minmax(180px, 1fr) 112px 86px 44px; }
}

@media (max-width: 940px) {
  .page-content { width: calc(100% - 16px); padding-top: 16px; padding-bottom: 28px; }
  .workspace-grid { grid-template-columns: 1fr; min-height: 0; }
  .results-panel { border-radius: 14px; }
  .discovery-toolbar { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .search-form { grid-template-columns: minmax(0, 1fr) 116px 44px; }
  .search-submit { grid-column: 2; }
  .toolbar-secondary { grid-column: 3; }
  /* position/display are re-declared here on purpose: this sheet loads after
     frontend-redesign.css, so its global sticky rule would otherwise out-rank
     the mobile fixed rule and the hidden sheet would keep occupying ~720px of
     document flow below the footer. */
  .share-panel { position: fixed; display: none; top: 70px; right: 8px; bottom: 82px; left: 8px; min-height: 0; max-height: none; border-radius: 14px; }
  .share-panel.is-mobile-open { display: flex; }
  .live-stats { right: 10px; bottom: 82px; left: auto; }
  /* The fixed live-stats pill (bottom: 82px, ~64px tall) covers the footer's
     copyright line on tablets; give the footer clearance above it. Two-class
     selector outranks theme.css's .site-footer rule, which loads later. */
  .app-shell .site-footer { padding-bottom: 156px; }
}

@media (max-width: 768px) {
  .workspace-grid { grid-template-columns: 1fr; }

  /* Card rows are fluid; the 700px desktop table floor must not leak in here. */
  .results-table { min-width: 0; }

  .table-wrap {
    min-height: 0;
    padding: 0 16px 24px;
    background: var(--bg-primary);
  }

  /* Card-mode skeleton (self-contained: the styles.css 700px block only covers
     below 700px, so 701-768px must define its own table/thead/tbody/td rules). */
  .results-table { display: block; }
  .results-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .results-table tbody { display: block; }
  .results-table td { display: block; height: auto; padding: 0; border: 0; }

  .results-table tbody {
    display: grid;
    gap: 12px;
  }

  .results-table tbody tr,
  .results-table tbody tr.is-selected {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    min-height: 92px;
    padding: 14px 14px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-card);
  }

  .results-table tbody tr.is-selected {
    border: 2px solid var(--brand);
    padding: 13px 13px;
    background: #CCFBF1;
    box-shadow: none;
  }

  /* Cell placement inside the card row (mirrors the 700px block in styles.css). */
  .checkbox-cell {
    grid-column: 1;
    grid-row: 1 / 4;
    align-self: center;
    text-align: center;
  }
  .file-name-cell {
    grid-column: 2 / -1;
    grid-row: 1;
  }
  .type-label {
    grid-column: 2;
    grid-row: 2;
  }
  .size-label {
    grid-column: 3;
    grid-row: 2;
    text-align: right;
  }
  .updated-label {
    grid-column: 2 / -1;
    grid-row: 3;
  }

  [data-theme="dark"] .results-table tbody tr.is-selected { background: var(--brand-soft); }
  .results-table tbody tr:last-child { border-bottom: 1px solid transparent; }
  .results-table td { padding: 0; }
  .checkbox-cell { width: 32px; }
  .file-name-wrap { gap: 10px; }
  .file-icon { width: 36px; height: 36px; }
  .file-name { font-size: 15px; }
  .file-detail-line { margin-top: 7px; }
  .type-label, .size-label { margin-top: 8px; color: var(--text-secondary); font-size: 12px; }
  .updated-label { margin-top: 4px; color: var(--text-secondary); font-size: 12px; }
  .type-label::before, .size-label::before, .updated-label::before { color: var(--text-faint); }

  .share-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    /* flex column (not block) so the empty state still fills the sheet height */
    display: flex;
    height: min(86vh, 720px);
    max-height: none;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 48px rgba(15, 23, 42, .2);
    visibility: hidden;
    transform: translateY(102%);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .28s;
  }

  .share-panel.is-mobile-open {
    display: flex;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .share-panel::before {
    display: block;
    width: 40px;
    height: 4px;
    margin: -8px auto 16px;
    border-radius: 99px;
    background: var(--line-strong);
    content: "";
  }

  .share-panel-backdrop {
    position: fixed;
    z-index: 65;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
  }

  .mobile-share-dock {
    z-index: 60;
    min-height: 72px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, .12);
  }

  .mobile-share-summary {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
  }

  .mobile-share-summary span { display: inline; }
  .mobile-share-summary strong { display: inline; }
  .mobile-share-button { min-height: 48px; padding-inline: 20px; border-radius: 999px; font-size: 15px; }
  .mobile-share-button .ui-icon { width: 18px; height: 18px; }

  .share-panel-header { min-height: 44px; }
  .share-panel h2 { font-size: 19px; }
  .selection-empty { min-height: 180px; }
}

@media (max-width: 700px) {
  .brand-copy small { display: none; }
  /* Stack the slide switcher under the card so the announcement keeps the full
     content width on phones. */
  .announcement-bar { grid-template-columns: minmax(0, 1fr); }
  .announcement-nav { justify-content: flex-end; margin: 8px 0 0; }
  .announcement-item { padding-inline: 14px; }
  .announcement-bar-title, .announcement-bar-content { font-size: 13px; }
  .results-heading { min-height: 82px; padding: 16px; }
  .results-heading h2 { font-size: 18px; }
  .results-table tbody tr { min-height: 72px; }
  .live-stat { grid-template-columns: 26px auto; column-gap: 8px; min-width: 0; padding-inline: 9px; }
  .live-stat .ui-icon { width: 26px; height: 26px; padding: 5px; border-radius: 8px; }

  /* Notice dialog is a bottom sheet here: the header becomes the drag handle for
     the swipe-to-dismiss gesture bound in app.js. */
  .notice-dialog-header {
    position: relative;
    padding-top: 20px;
    touch-action: none;
    cursor: grab;
  }
  .notice-dialog-header::before {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: var(--line-strong);
    content: "";
    transform: translateX(-50%);
  }
  .notice-dialog-header:active { cursor: grabbing; }
}

/* Full-screen startup mask, aligned with design/02-loading-mask.png. */
.initial-loading {
  z-index: 1000;
  gap: 10px;
  color: var(--text-primary);
  background: var(--bg-primary);
  opacity: 1;
  transition: opacity .2s ease, visibility 0s linear 0s;
}

.initial-loading::before {
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: var(--brand) url("/assets/brand/logo-mark.svg?v=20260812-2") center / 58px 58px no-repeat;
  box-shadow: 0 14px 28px color-mix(in srgb, var(--brand) 26%, transparent);
  content: "";
}

.initial-loading strong { font-size: 18px; font-weight: 750; }
.initial-loading > span:last-child { color: var(--text-secondary); font-size: 13px; }
.initial-loading-spinner { width: 40px; height: 40px; margin: 0 0 2px; border-width: 4px; border-color: color-mix(in srgb, var(--border) 75%, transparent); border-top-color: var(--brand); }
.initial-loading.is-fading { visibility: hidden; opacity: 0; transition-delay: 0s, .2s; }

@media (prefers-reduced-motion: reduce) {
  .share-panel { transition-duration: .01ms; }
  .initial-loading, .initial-loading.is-fading { transition-duration: .01ms; }
}

@media (prefers-reduced-motion: reduce) {
  .results-table tbody tr { transition-duration: .01ms; }
}
