/* Subtwine styles — the library page (R6): its head, the balance banner, the
   drop zone, the group bar and status filter, and the material cards.
   Loaded from index.html in the order web_manifest.py declares. */
.library-view {
  width:min(1180px,calc(100% - 40px));
  margin:0 auto;
  padding:28px 0 96px;
}
.lib-head {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.lib-head h1 {
  font-size:26px;
  font-weight:700;
  letter-spacing:-.02em;
}
.lib-sub {
  margin:4px 0 0;
  color:var(--muted);
  font-size:13.5px;
}
.lib-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

/* ---- the balance banner ---- */
.banner {
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  border-radius:12px;
  margin-bottom:16px;
  font-size:13.5px;
}
.banner.warn {
  background:var(--diff-bg);
  color:var(--diff);
}
.banner.low {
  background:color-mix(in srgb,var(--fail) 12%,var(--surface));
  color:var(--fail);
}
.banner-text {
  flex:1 1 auto;
  min-width:0;
  margin:0;
  color:var(--ink);
}

/* ---- the drop zone ---- */
.dropzone {
  display:flex;
  align-items:center;
  gap:16px;
  width:100%;
  padding:22px 24px;
  border:1.5px dashed var(--line-strong);
  border-radius:14px;
  background:var(--surface);
  cursor:pointer;
  transition:border-color .12s,background .12s;
  margin-bottom:22px;
  flex-wrap:wrap;
  text-align:start;
}
.dropzone:hover {
  border-color:var(--accent);
  background:var(--row-active);
}
.dz-icon {
  width:44px;
  height:44px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background:var(--accent-soft);
  color:var(--accent-ink);
  flex:none;
}
.dz-main {
  display:grid;
  gap:2px;
  flex:1 1 220px;
  min-width:0;
}
.dz-main b {
  font-size:15px;
}
.dz-main span {
  color:var(--muted);
  font-size:13px;
}
.dz-fine {
  display:grid;
  gap:2px;
  text-align:end;
  font-size:12px;
  color:var(--faint);
  min-width:0;
}
.dropzone.hero {
  flex-direction:column;
  text-align:center;
  padding:56px 24px;
}
.dropzone.hero .dz-icon {
  width:60px;
  height:60px;
  border-radius:16px;
}
.dropzone.hero .dz-main {
  flex:none;
}
.dropzone.hero .dz-main b {
  font-size:19px;
}
.dropzone.hero .dz-fine {
  text-align:center;
}

/* ---- the group bar and the filter ---- */
.lib-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.groups {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  align-items:center;
  min-width:0;
}
.grp {
  display:inline-flex;
  align-items:center;
  border-radius:99px;
  background:var(--surface-2);
  max-width:100%;
  min-width:0;
}
.grp>button:first-child {
  display:inline-flex;
  align-items:center;
  gap:5px;
  min-height:30px;
  padding:0 12px;
  border-radius:99px;
  font-size:13px;
  color:var(--ink-2);
  white-space:nowrap;
  min-width:0;
  max-width:260px;
  overflow:hidden;
  text-overflow:ellipsis;
}
.grp>button:first-child>span:not(.i) {
  overflow:hidden;
  text-overflow:ellipsis;
}
.grp>button:first-child:hover {
  color:var(--ink);
}
.grp em {
  font-style:normal;
  color:var(--faint);
  font-size:12px;
}
.grp.on {
  background:var(--accent-soft);
}
.grp.on>button:first-child {
  color:var(--accent-ink);
  font-weight:600;
}
.grp.drop {
  outline:2px dashed var(--accent);
  outline-offset:1px;
}
.grp-more {
  width:26px;
  height:26px;
  margin-inline-end:3px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:var(--accent-ink);
}
.grp-more:hover {
  background:color-mix(in srgb,var(--accent) 18%,transparent);
}
.grp-new {
  display:inline-flex;
  align-items:center;
  gap:4px;
  min-height:30px;
  padding:0 10px;
  border-radius:99px;
  border:1px dashed var(--line-strong);
  font-size:12.5px;
  color:var(--muted);
}
.grp-new:hover {
  color:var(--ink);
  border-color:var(--accent);
}

/* ---- the cards ---- */
.cards {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(250px,1fr));
  gap:18px;
}
.card {
  position:relative;
  display:flex;
  flex-direction:column;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  overflow:hidden;
  min-width:0;
  cursor:pointer;
  transition:box-shadow .15s,border-color .15s;
}
.card:hover {
  border-color:var(--line-strong);
  box-shadow:var(--shadow-menu);
}
.card.dragging {
  opacity:.5;
}
.thumb {
  position:relative;
  aspect-ratio:16/9;
  background:#101116 center/cover no-repeat;
  display:grid;
  place-items:center;
  color:#fff;
}
.thumb.audio {
  background:linear-gradient(135deg,color-mix(in srgb,var(--accent) 70%,#000),#15162a);
}
.thumb.blank {
  background:linear-gradient(135deg,#2a2c3a,#15161d);
}
.thumb .wave {
  display:flex;
  gap:3px;
  align-items:center;
  height:40px;
  opacity:.85;
}
.thumb .wave i {
  display:block;
  width:3px;
  border-radius:2px;
  background:#fff;
}
.thumb .ph {
  opacity:.5;
}
.thumb .dur {
  position:absolute;
  right:8px;
  bottom:8px;
  font-size:11.5px;
  padding:1px 7px;
  border-radius:6px;
  background:rgba(0,0,0,.66);
  color:#fff;
  font-variant-numeric:tabular-nums;
}
.thumb.dim::after {
  content:"";
  position:absolute;
  inset:0;
  background:rgba(10,10,14,.35);
}
.card-body {
  display:grid;
  gap:6px;
  padding:12px 14px 14px;
  min-width:0;
}
.card-title {
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}
.card-open {
  display:flex;
  align-items:center;
  gap:6px;
  flex:1;
  min-width:0;
  text-align:start;
  border-radius:6px;
}
.card-open .i {
  color:var(--muted);
}
.card-open b {
  font-size:14px;
  font-weight:600;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width:0;
}
.card-title .icon-btn {
  margin:-4px -6px -4px 0;
}
.card-langs {
  display:flex;
  gap:8px;
  font-size:12.5px;
  color:var(--muted);
  overflow:hidden;
  white-space:nowrap;
  min-width:0;
}
.card-langs>span:first-child {
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0;
}
.card-grp {
  display:inline-flex;
  align-items:center;
  gap:3px;
  color:var(--faint);
  flex:none;
  max-width:50%;
  overflow:hidden;
}
.card-grp span {
  overflow:hidden;
  text-overflow:ellipsis;
}
.status {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12.5px;
  min-height:28px;
  flex-wrap:wrap;
  min-width:0;
}
.status-text {
  flex:1 1 120px;
  min-width:0;
  overflow-wrap:anywhere;
}
.status .dot {
  width:7px;
  height:7px;
  border-radius:50%;
  flex:none;
}
.status.done {
  color:var(--ok);
}
.status.done .dot {
  background:var(--ok);
}
.status.busy {
  color:var(--busy);
}
.status.busy .dot {
  background:var(--busy);
  animation:pulse 1.2s infinite;
}
.status.fail {
  color:var(--fail);
}
.status.fail .dot {
  background:var(--fail);
}
.status.new {
  color:var(--muted);
}
.status.new .dot {
  background:var(--faint);
}
.status .dot.sub {
  background:var(--accent);
}
.status .sub {
  color:var(--muted);
}
.status .btn {
  margin-inline-start:auto;
}
.card .meter {
  margin:0;
}
.card .meter i {
  background:var(--busy);
}
.fail-reason {
  font-size:12px;
  color:var(--muted);
  margin:0;
  overflow-wrap:anywhere;
}
.card-media:empty {
  display:none;
}
.library-state {
  display:inline-block;
  font-size:11.5px;
  padding:1px 7px;
  border-radius:6px;
  background:var(--surface-2);
  color:var(--muted);
}
.library-state.busy {
  color:var(--busy);
}
.library-state.fail,
.library-state.moved {
  color:var(--fail);
  background:color-mix(in srgb,var(--fail) 10%,var(--surface));
}
.library-empty,
.library-none {
  grid-column:1 / -1;
  text-align:center;
  color:var(--muted);
  padding:10px 0 20px;
  margin:0;
}
.library-empty b {
  display:block;
  color:var(--ink);
  font-size:15px;
  margin-bottom:4px;
}
.library-empty p {
  margin:0;
}
.folder-name {
  margin-inline-start:auto;
  color:var(--ink-2);
  overflow-wrap:anywhere;
}
.storage-note {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  gap:8px;
  margin:28px 0 0;
  padding-top:16px;
  border-top:1px solid var(--line-soft);
  font-size:12.5px;
  color:var(--muted);
}

@media (max-width:640px) {
  .library-view {
    width:calc(100% - 32px);
    padding-top:20px;
  }
  .lib-head h1 {
    font-size:22px;
  }
  .lib-actions {
    width:100%;
  }
  .lib-actions .btn {
    flex:1;
  }
  .dropzone {
    padding:16px;
  }
  .dz-fine {
    text-align:start;
  }
  .dropzone.hero {
    padding:36px 16px;
  }
  .cards {
    grid-template-columns:minmax(0,1fr);
  }
  .groups {
    width:100%;
  }
}
/* T027: a material recognised only in part says how far its subtitles go. */
.card-partial {
  font-size:12px;
  color:var(--ink-2);
  margin:0;
  overflow-wrap:anywhere;
}
