/* Cloud library (app/cloud.js): the "Cloud storage 18 / 25" meter, papers only in the account, the Manage panel,
   the "account is full" dialog, the delete prompt and the desk's download screen. LockIn tokens from tokens.css:
   one accent, status colours only. */

/* ---------- the meter (library, Your papers) ---------- */
.cl-bar { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 12px; margin: 0 0 12px; background: var(--chrome); border: 1px solid var(--line); border-radius: var(--radius); }
.cl-ic { width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
:root[data-theme="light"] .cl-ic { color: var(--text); }
.cl-bar.off .cl-ic { background: var(--subtle); color: var(--faint); }
.cl-bar.full .cl-ic { background: var(--warn-bg); color: var(--warn); }
.cl-main { flex: 1; min-width: 0; }
.cl-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cl-name { font-size: 11px; font-weight: 750; letter-spacing: 1.3px; text-transform: uppercase; font-stretch: 87%; color: var(--muted); white-space: nowrap; }
.cl-count { color: var(--faint); font-size: 13px; font-weight: 700; white-space: nowrap; }
.cl-count b { color: var(--text); font-size: 17px; font-weight: 850; font-stretch: 85%; }
.cl-meter { position: relative; flex: 1; max-width: 240px; min-width: 60px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.cl-meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s; }
.cl-meter.full i { background: var(--warn); }
.cl-line { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-line.warn { color: var(--warn-text); }
.cl-line.busy { color: var(--text-2); }
.cl-line.good { padding-left: 12px; text-indent: -12px; }   /* a wrapped second line starts under the words, not the dot */
.cl-line.good::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%; background: var(--good); }
.cl-acts { display: flex; align-items: center; gap: 8px; flex: none; }

/* a paper's state on its library card */
.pc-cloud { display: inline-flex; align-items: center; color: var(--faint); flex: none; }
.pc-cloud .i { width: 15px; height: 15px; }
.pc-cloud.stored { color: var(--muted); }
.pc-cloud.uploading, .pc-cloud.pending { color: var(--accent); }
:root[data-theme="light"] .pc-cloud.uploading, :root[data-theme="light"] .pc-cloud.pending { color: var(--text); }
.pc-cloud.waiting { color: var(--warn); }
/* the badge sits before "2h ago" on cards and rows, centred on the text */
.pc-foot .pc-when, .pr-when { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- papers only in the account ---------- */
.cl-only { margin-top: 18px; }
.cl-only-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 10px; }
.cl-only-head .hs-h { margin: 0; }
.cl-only-head small { margin-left: auto; color: var(--faint); font-size: 12px; }
.cl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 370px), 1fr)); gap: 10px; }
.pc.cl-card { grid-template-columns: 62px minmax(0, 1fr); min-height: 0; border-style: dashed; border-color: var(--line-strong); }
.pc.cl-card:hover { border-color: var(--accent-line); }
.pc.cl-card.busy { cursor: default; opacity: .75; }
.cl-cover { position: relative; width: 62px; aspect-ratio: 595 / 842; border-radius: 3px; border: 1px dashed var(--line-strong); background: var(--rail); display: grid; place-items: center; align-self: start; color: var(--faint); }
.cl-cover .i { width: 24px; height: 24px; stroke-width: 1.6; }
.pc.cl-card:hover .cl-cover { color: var(--accent); border-color: var(--accent-line); }
:root[data-theme="light"] .pc.cl-card:hover .cl-cover { color: var(--text); }
.cl-cover small { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 8.5px; font-weight: 850; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.cl-tag { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.cl-tag .i { stroke-width: 2; }
.cl-card .pc-title { margin-top: 4px; }
.cl-open, .cl-wait { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 650; white-space: nowrap; }
.cl-open .i, .cl-wait .i { width: 14px; height: 14px; }
.cl-wait { color: var(--muted); }
.cl-old { color: var(--warn-text) !important; }
.cl-none { margin: 0; padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
/* nothing in this browser yet, but papers in the account */
.cl-lead { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--chrome); border: 1px solid var(--line); border-radius: var(--radius); }
.cl-lead .cl-ic { width: 40px; height: 40px; }
.cl-lead-t { flex: 1; min-width: 0; }
.cl-lead h2 { margin: 0; font-size: 22px; }
.cl-lead p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.cl-lead-acts { display: flex; gap: 8px; flex: none; }

/* ---------- dialogs: Manage and "account is full" ---------- */
.cl-dlg { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.cl-dlg[open] { display: flex; flex-direction: column; }
.cl-dlg .pd-dlg-head { padding-right: 12px; }
.cl-headtxt { flex: 1; min-width: 0; }
.cl-close { margin: -4px -2px 0 auto; }
.badge.warnb { background: var(--warn-bg); color: var(--warn); }
.cl-mbody, .cl-fbody { display: grid; gap: 12px; min-height: 0; overflow: auto; }
.cl-mmeter { display: flex; align-items: center; gap: 12px; color: var(--faint); font-weight: 700; }
.cl-mmeter b { color: var(--text); font-size: 18px; font-weight: 850; font-stretch: 85%; }
.cl-meter.big { max-width: none; height: 8px; border-radius: 4px; }
.cl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: -12px; background: var(--rail); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.cl-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.cl-all input, .cl-pick input, .cl-also input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
:root[data-theme="light"] .cl-all input, :root[data-theme="light"] .cl-pick input, :root[data-theme="light"] .cl-also input { accent-color: var(--text); }
.cl-sp { flex: 1; }
.cl-tools .btn .i { width: 15px; height: 15px; }
.cl-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--chrome); max-height: min(44vh, 420px); overflow: auto; overscroll-behavior: contain; }
.cl-flist { border-radius: var(--radius-sm); max-height: min(34vh, 300px); }
.cl-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-top: 1px solid var(--line-soft); }
.cl-flist .cl-row { grid-template-columns: minmax(0, 1fr) auto; }
.cl-row:first-child { border-top: 0; }
.cl-row.on { background: var(--accent-soft); }
.cl-row.oldest { background: var(--subtle); }
.cl-pick { display: grid; place-items: center; height: 100%; cursor: pointer; }
.cl-rmain { min-width: 0; }
.cl-rmain b { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-rmain small { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 2px; color: var(--muted); font-size: 12px; }
.cl-where { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); white-space: nowrap; }
.cl-where .i { width: 13px; height: 13px; }
.cl-where.away { color: var(--text-2); }
.cl-where.busy { color: var(--accent); }
:root[data-theme="light"] .cl-where.busy { color: var(--text); }
.btn.cl-rm { height: 28px; padding: 0 8px; gap: 4px; color: var(--muted); }
.btn.cl-rm .i { width: 14px; height: 14px; }
.btn.cl-rm:hover:not(:disabled) { color: var(--bad); background: var(--bad-bg); }
.cl-racts { display: flex; align-items: center; gap: 2px; }
.btn.cl-op { height: 28px; padding: 0 8px; gap: 4px; color: var(--text-2); }
.btn.cl-op .i { width: 14px; height: 14px; }
.btn.cl-op:hover:not(:disabled) { color: var(--text); background: var(--subtle); }
.cl-p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.cl-empty { display: flex; gap: 10px; align-items: center; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.cl-note { display: flex; gap: 9px; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.cl-note .i { width: 15px; height: 15px; margin-top: 1px; color: var(--faint); }
.cl-note.warn { padding: 8px 10px; border: 1px solid var(--warn-line); border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-text); }
.cl-note.warn .i { color: var(--warn); }
.cl-switch { margin-top: 2px; }
.cl-mfoot, .cl-ffoot { flex-wrap: wrap; align-items: center; }
.cl-lbl { font-size: 11px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; font-stretch: 87%; color: var(--muted); }
.cl-sub { margin-bottom: -6px; }
.cl-oldest { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 2px 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: var(--radius-sm); background: var(--accent-soft); }
.cl-oldest b { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-oldest small { grid-column: 2; color: var(--muted); font-size: 12px; }
.btn.cl-mlink { padding: 0 8px; margin-left: -8px; }

/* deleting a paper here: also from the account? */
.cl-also { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--rail); cursor: pointer; }
.cl-also input { margin-top: 2px; }
.cl-also b { display: block; font-size: 13px; font-weight: 700; }
.cl-also small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }

/* ---------- the desk: bringing a paper from the account ---------- */
.cl-dl-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--desk); }
.cl-dl { width: min(460px, 100%); display: grid; gap: 10px; justify-items: start; padding: 22px; background: var(--chrome); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.cl-dl-ic { width: 44px; height: 44px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.cl-dl-ic .i { width: 24px; height: 24px; stroke-width: 2; }
.cl-dl h1 { margin: 2px 0 0; font-size: 28px; overflow-wrap: anywhere; }
.cl-dl .sh-busy { width: 100%; }
.cl-dl.bad .sh-plabel { color: var(--bad-text); }
.cl-dl.bad .sh-pbar { display: none; }
.cl-dl-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-dl-acts:empty { display: none; }

/* ---------- phone ---------- */
@media (max-width: 640px) {
  /* one row: the words and Manage side by side (the icon makes room); with Make room too, the buttons go below */
  .cl-bar { flex-wrap: wrap; row-gap: 8px; padding: 9px 10px 9px 12px; gap: 10px; }
  .cl-bar .cl-ic { display: none; }
  .cl-main { flex: 1 1 0; }
  .cl-top { gap: 8px; }
  .cl-line { white-space: normal; }
  .cl-acts { align-self: flex-start; }
  .cl-bar.two .cl-main { flex-basis: 100%; }
  .cl-bar.two .cl-acts { flex-basis: 100%; }
  .cl-bar.two .cl-acts .btn { flex: 1 1 0; }
  .cl-only-head small { margin-left: 0; flex-basis: 100%; }
  .cl-lead { flex-wrap: wrap; align-items: flex-start; padding: 14px; }
  .cl-lead h2 { font-size: 20px; }
  .cl-lead-t { flex-basis: calc(100% - 54px); }
  .cl-lead-acts { flex-basis: 100%; }
  .cl-lead-acts .btn { flex: 1 1 0; }
  .cl-dlg .pd-dlg-head { padding: 14px 10px 0 14px; }
  .cl-dlg .pd-dlg-body { padding: 12px 14px 0; }
  .cl-dlg .pd-dlg-foot { padding: 14px; }
  .cl-tools { padding: 8px; }
  .cl-tools .cl-sp { display: none; }
  .cl-tools .btn { flex: 1 1 100%; justify-content: center; }
  .cl-all { flex: 1 1 100%; }
  .btn.cl-rm span, .btn.cl-op span { display: none; }
  .cl-mbody .cl-rmain b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
  .btn.cl-rm, .btn.cl-op { width: 32px; padding: 0; justify-content: center; }
  .cl-ffoot .cl-sp { display: none; }
  .cl-ffoot .btn:not(.cl-mlink) { flex: 1 1 auto; }
  .cl-dl { padding: 18px; }
  .cl-dl h1 { font-size: 24px; }
}
