:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7c;
  --line: #dde3ea;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --err: #cf222e;
  --bar: #e6ebf1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --card: #171d25;
    --text: #e6edf3;
    --muted: #93a1b0;
    --line: #2a333e;
    --accent: #4493f8;
    --accent-text: #0b1220;
    --ok: #3fb950;
    --warn: #d29922;
    --err: #f85149;
    --bar: #242c36;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 420px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=password], input[type=text] {
  width: 100%; padding: 12px 14px; font-size: 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
input.code { letter-spacing: .3em; font-size: 1.3rem; text-align: center; font-variant-numeric: tabular-nums; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; font-size: 1rem; font-weight: 600; border-radius: 10px; border: 0;
  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none;
}
button.secondary { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 12px; font-size: .9rem; }
button:disabled { opacity: .5; cursor: default; }
.full { width: 100%; margin-top: 20px; }
.big { width: 100%; padding: 22px; font-size: 1.15rem; }
.muted { color: var(--muted); font-size: .92rem; }
.error { color: var(--err); min-height: 1.5em; margin-top: 10px; }
.hidden { display: none !important; }
.qr { background: #fff; border-radius: 10px; padding: 8px; width: 220px; margin: 12px auto; }
.qr svg { width: 100%; height: auto; display: block; }
code.secret { display: block; word-break: break-all; padding: 10px; background: var(--bg); border-radius: 8px; font-size: .95rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg); border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .82rem; }
.progress { height: 8px; background: var(--bar); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#overall { margin: 14px 0 6px; }
ul.files { list-style: none; padding: 0; margin: 0; }
ul.files li { padding: 10px 0; border-top: 1px solid var(--line); }
ul.files li:first-child { border-top: 0; }
.row { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.st { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.st.ok { color: var(--ok); }
.st.warn { color: var(--warn); }
.st.err { color: var(--err); }
li .progress { margin-top: 6px; height: 5px; }
.tip { border-left: 3px solid var(--warn); padding: 8px 12px; background: var(--bg); border-radius: 0 8px 8px 0; font-size: .9rem; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
td { padding: 6px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
td:last-child, td:nth-child(2) { text-align: right; }
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: span 2; }
}

/* --- aplicación con galería --- */
:root { --tile-bg: #e6ebf1; --overlay: #0a0e14; --sel: #1f6feb; }
@media (prefers-color-scheme: dark) { :root { --tile-bg: #1d242d; --sel: #4493f8; } }
body.app main { max-width: 1200px; padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
body.noscroll { overflow: hidden; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.05rem; white-space: nowrap; }
.tabs { display: flex; gap: 4px; margin: 0 auto; background: var(--bg); padding: 3px; border-radius: 10px; }
.tabs button { background: transparent; color: var(--muted); padding: 8px 16px; font-size: .95rem; border-radius: 8px; }
.tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
@media (max-width: 560px) { .topbar h1 { display: none; } .tabs { margin-left: 0; } }
button.small { padding: 6px 10px; font-size: .85rem; }
button.danger { background: var(--err); color: #fff; }
.danger-text { color: var(--err) !important; }
.grow { flex: 1; }

.crumbs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; margin: 4px 0 10px; }
.crumb { background: transparent; color: var(--accent); padding: 6px 8px; font-size: 1rem; font-weight: 600; border-radius: 8px; }
.crumb + .crumb::before { content: "›"; color: var(--muted); margin-right: 8px; font-weight: 400; }
.crumb.current { color: var(--text); cursor: default; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar button { padding: 8px 12px; font-size: .9rem; }
.summary { margin: 10px 0; min-height: 1.2em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; } }
.tile {
  position: relative; aspect-ratio: 1; padding: 0; border-radius: 8px; overflow: hidden;
  background: var(--tile-bg); color: var(--text); font-weight: 500; display: block; width: 100%;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.dir { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; }
.dir-icon svg { width: 52px; height: 52px; color: var(--accent); }
.file-icon { display: flex; align-items: center; justify-content: center; height: 100%; }
.file-icon svg { width: 40px; height: 40px; color: var(--muted); }
.tile .label { font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.file .label { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; }
.tile .count { font-size: .75rem; color: var(--muted); }
.tile .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tile .play svg { width: 36px; height: 36px; }
.tile .badge {
  position: absolute; top: 6px; left: 6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--warn); color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.tile .tick {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: none;
  border: 2px solid #fff; background: rgba(0,0,0,.25); color: #fff; align-items: center; justify-content: center;
}
.tile .tick svg { width: 14px; height: 14px; visibility: hidden; }
body.selecting .tile .tick, .tile.trash .tick { display: flex; }
.tile.selected { outline: 3px solid var(--sel); outline-offset: -3px; }
.tile.selected .tick { background: var(--sel); border-color: var(--sel); }
.tile.selected .tick svg { visibility: visible; }
.tile.selected img { transform: scale(.92); border-radius: 6px; transition: transform .12s; }
.empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 40px 0; }

.selbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.12);
}
.selbar-top { display: flex; align-items: center; gap: 8px; max-width: 1200px; margin: 0 auto 8px; }
.selbar-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 1200px; margin: 0 auto; }
.selbar-actions button { padding: 10px 4px; font-size: .85rem; }
@media (min-width: 700px) { .selbar-actions { grid-template-columns: repeat(5, auto); justify-content: start; } .selbar-actions button { padding: 10px 16px; } }

.dest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }

/* visor */
.viewer { position: fixed; inset: 0; z-index: 50; background: var(--overlay); color: #fff; display: flex; flex-direction: column; }
.v-top, .v-bottom { position: relative; z-index: 2; padding: 10px 12px; }
.v-top { display: flex; align-items: center; gap: 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.v-title { display: flex; flex-direction: column; min-width: 0; }
.v-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-title span, .v-info { color: #aab4bf; font-size: .85rem; }
.v-btn { background: rgba(255,255,255,.12); color: #fff; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.1rem; flex-shrink: 0; }
.v-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pinch-zoom; }
.v-stage img, .v-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-msg { color: #aab4bf; text-align: center; padding: 20px; }
.v-msg svg { width: 48px; height: 48px; }
.v-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 72px; padding: 0;
  background: rgba(255,255,255,.1); color: #fff; font-size: 2rem; border-radius: 10px;
}
.v-prev { left: 8px; } .v-next { right: 8px; }
.v-nav:disabled { visibility: hidden; }
@media (hover: none) { .v-nav { display: none; } }
.v-bottom { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.v-info { margin-bottom: 8px; text-align: center; }
.v-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.v-actions button { background: rgba(255,255,255,.12); color: #fff; padding: 10px 14px; font-size: .9rem; }

/* diálogos y avisos */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) { .modal { align-items: center; } }
.modal-box {
  background: var(--card); color: var(--text); width: 100%; max-width: 460px; max-height: 85vh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { .modal-box { border-radius: 16px; } }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.picker { list-style: none; padding: 0; margin: 8px 0 0; max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.picker li { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--line); cursor: pointer; }
.picker li:first-child { border-top: 0; }
.picker li svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.picker li.disabled { opacity: .4; cursor: default; }
.picker li.muted { cursor: default; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 70;
  background: #1c2430; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .92rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }
body.selecting .toast { bottom: calc(130px + env(safe-area-inset-bottom)); }

/* ajustes para pantallas pequeñas */
body.app main { padding-top: 12px; }
.crumbs { margin-top: 0; }
@media (max-width: 560px) {
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar button { flex-shrink: 0; padding: 7px 11px; font-size: .85rem; }
  .toolbar .grow { flex: 0 0 0; }
}
.modal-actions button { padding: 10px 14px; font-size: .95rem; }
.tile.dir .count::after { content: " elementos"; }

/* filtro por periodo */
.period { margin-bottom: 14px; }
.period label { margin-top: 0; }
.period select, .range-row input {
  width: 100%; padding: 11px 12px; font-size: 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.range-row label { margin: 0; font-weight: 500; font-size: .9rem; color: var(--muted); }
.range-row input { margin-top: 4px; }
.small-text { font-size: .85rem; margin: 8px 0 0; }
.card-inset { background: var(--bg); border-radius: 10px; padding: 12px 14px; margin-top: 14px; font-size: .95rem; }
.card-inset p { margin: 0 0 6px; }
.card-inset details { margin-top: 8px; }
.card-inset summary { cursor: pointer; color: var(--muted); }
.card-inset details button { margin-top: 10px; }
.card-inset.warn-box { border-left: 3px solid var(--warn); }
#atajo-card code { font-size: .85rem; word-break: break-all; }
#atajo-token-box { margin-bottom: 12px; }
#atajo-token-box .secret { margin: 8px 0; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 12px 0 0; }
label.check input { width: 20px; height: 20px; }
#icloud-card input[type=text], #icloud-card input[type=password] { margin-bottom: 4px; }
.toolbar.spaced { margin-top: 10px; }
/* Campo de contraseña de Apple como texto oculto: así Safari no le ofrece la contraseña guardada de esta web. */
.secret-input { -webkit-text-security: disc; text-security: disc; font-family: inherit; }

/* ===================== v2: biblioteca, uso, álbumes, administración ===================== */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s-muted: #a3a29b;
  --seq: #2a78d6; --track: #e3ebf6; --crit: #cf222e; --warnc: #bf8700;
}
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s-muted: #6b6a64; --seq: #3987e5; --track: #22303f; --crit: #f85149; --warnc: #d29922; }
}
.layout { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1500px; margin: 0 auto; }
@media (min-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 8px; } }
body.app main { max-width: none; width: 100%; }
.lib-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.lib-head h2 { font-size: 1.3rem; margin: 0; }
.viewbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.view-chip {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 14px; font-weight: 500; font-size: .92rem; text-align: left; max-width: 100%;
}
.view-chip .chip-label { color: var(--accent); font-weight: 700; margin-right: 4px; }
#lib-search { flex: 1; min-width: 160px; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: .95rem; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 1rem; margin: 18px 0 8px; position: sticky; top: 58px; background: var(--bg); padding: 6px 0; z-index: 5; }
#lib .grid { margin-bottom: 6px; }
.flist { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.frow {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto 34px; gap: 10px; align-items: center;
  padding: 6px 10px; background: transparent; color: var(--text); border-radius: 0; border-top: 1px solid var(--line);
  font-weight: 400; text-align: left; position: relative; -webkit-touch-callout: none; user-select: none;
}
.frow:first-child { border-top: 0; }
.ficon { width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: var(--tile-bg); display: flex; align-items: center; justify-content: center; }
.ficon img { width: 100%; height: 100%; object-fit: cover; }
.ficon svg { width: 22px; height: 22px; color: var(--muted); }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdate, .fsize { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fsize { text-align: right; min-width: 64px; }
.fcopy { font-size: .8rem; text-align: center; }
.fcopy.ok { color: var(--ok); } .fcopy.warn { color: var(--warn); }
.frow .tick { position: static; display: none; }
body.selecting .frow .tick { display: flex; }
.frow.selected { background: color-mix(in srgb, var(--sel) 12%, transparent); }
@media (max-width: 560px) { .frow { grid-template-columns: 40px minmax(0, 1fr) auto 26px; } .frow .fdate { display: none; } }
#lib-more { text-align: center; padding: 16px; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 560px) { .album-grid { grid-template-columns: 1fr 1fr; } }
.album-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; background: transparent; color: var(--text); text-align: left; font-weight: 600; }
.album-cover { width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--tile-bg); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-cover svg { width: 48px; height: 48px; color: var(--muted); }
.album-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* panel de uso */
.usage { position: relative; padding: 12px 16px 120px; }
@media (min-width: 1000px) {
  .usage { position: sticky; top: 58px; align-self: start; max-height: calc(100vh - 70px); overflow: auto;
    border-left: 1px solid var(--line); padding: 20px 18px 40px; }
}
@media (max-width: 999px) { .usage { border-top: 1px solid var(--line); margin: 0 16px; padding: 16px 0 140px; } }
.usage h3 { font-size: .9rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.usage-block { margin-top: 22px; }
.hero-num { margin: 2px 0 8px; } .hero-num b { font-size: 2rem; font-variant-numeric: tabular-nums; }
.meter { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--seq); border-radius: 99px; transition: width .3s; }
.meter > div.warnf { background: var(--warnc); } .meter > div.crit { background: var(--crit); }
.stack { display: flex; gap: 2px; height: 16px; min-height: 16px; align-items: stretch; }
.seg-fill { min-width: 3px; border-radius: 2px; cursor: default; }
.seg-fill:first-child { border-radius: 4px 2px 2px 4px; } .seg-fill:last-child { border-radius: 2px 4px 4px 2px; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); } .s-muted { background: var(--s-muted); }
.legend { list-style: none; padding: 0; margin: 10px 0 0; font-size: .88rem; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 3px 0; }
.sw { width: 12px; height: 12px; border-radius: 3px; }
.lg-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.bars { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.bars li { display: grid; grid-template-columns: 44px 1fr 64px; gap: 8px; align-items: center; padding: 3px 0; }
.bar-label { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; }
.bar-fill { display: block; height: 100%; background: var(--seq); border-radius: 0 4px 4px 0; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }
.viz-tip { position: absolute; left: 0; top: 0; z-index: 10; pointer-events: none; background: var(--text); color: var(--bg);
  padding: 6px 9px; border-radius: 8px; font-size: .82rem; max-width: 260px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.st.ok { color: var(--ok); } .st.warn { color: var(--warn); } .st.err { color: var(--err); }

/* selector de vista */
fieldset { border: 0; padding: 0; margin: 14px 0 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg + .seg { margin-top: 6px; }
.seg button { background: var(--bg); color: var(--text); border: 1px solid var(--line); padding: 8px 12px; font-size: .9rem; font-weight: 500; }
.seg button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#vs-year { width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 1rem; }
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.menu-list button { margin: 0; }

/* administración */
.form-row { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: 10px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-row label { margin: 0; font-weight: 500; font-size: .9rem; }
.form-row input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 1rem; margin-top: 4px; }
#invite-form button[type=submit] { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table.users { min-width: 640px; }
table.users th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; padding: 6px 4px; }
table.users td { vertical-align: top; padding: 10px 4px; text-align: left; }
table.users td.num, table.users th.num { text-align: right; white-space: nowrap; }
table.users td:nth-child(2), table.users td:last-child { text-align: left; }
.u-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#inv-link code { display: block; word-break: break-all; margin-top: 6px; }

/* invitación */
.choice { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-weight: 400; margin: 0; cursor: pointer; }
.option input { margin-top: 4px; width: 18px; height: 18px; }
.spaced-title { margin-top: 22px; }
input[type=email] { width: 100%; padding: 12px 14px; font-size: 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
@media (max-width: 560px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; margin: 0; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 8px 10px; font-size: .9rem; white-space: nowrap; flex-shrink: 0; }
  #account-btn { flex-shrink: 0; }
}
.modal-box { overflow-x: hidden; }
.seg button { white-space: nowrap; }
html, body { overflow-x: hidden; }
.icon-btn { padding: 6px 8px; }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.mini-usage { display: none; }
@media (max-width: 999px) {
  .mini-usage { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 10px 12px; margin: 0 0 12px;
    background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; font-size: .9rem; font-weight: 500; text-align: left; }
  .mini-usage .meter { height: 6px; display: block; }
  .mini-usage .meter > span { display: block; height: 100%; width: 0; background: var(--seq); border-radius: 99px; }
  .mini-usage .meter > span.warnf { background: var(--warnc); } .mini-usage .meter > span.crit { background: var(--crit); }
}
.spaced-bottom { margin-bottom: 14px; }
.frow { grid-template-columns: 44px minmax(0, 1fr) auto auto 82px; }
.fcopy { white-space: nowrap; text-align: right; }
@media (max-width: 560px) { .frow { grid-template-columns: 40px minmax(0, 1fr) auto 64px; } .fcopy { font-size: .74rem; } }
@media (max-width: 999px) {
  .mini-usage { align-items: stretch; justify-content: flex-start; }
  .mini-usage > span:first-child { text-align: left; }
  .mini-usage .meter { width: 100%; }
}

/* --- fondo: collage de fotos impresas, algo giradas y superpuestas, sobre un degradado que combina --- */
:root { --paper: #ffffff; --wash: linear-gradient(160deg, #d9e7f3 0%, #eef1f2 45%, #f3eadb 100%); }
@media (prefers-color-scheme: dark) { :root { --paper: #1b2230; --wash: linear-gradient(160deg, #0a1020 0%, #121a2a 55%, #23202a 100%); } }
body.auth, body.app { position: relative; isolation: isolate; background: var(--bg); }
body.auth::before, body.app::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--wash); }
.collage { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.collage img {
  position: absolute; display: block; object-fit: cover; border: clamp(4px, .7vw, 9px) solid var(--paper);
  border-radius: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, .28), 0 2px 6px rgba(0, 0, 0, .18);
}
/* ordenador: alrededor de la tarjeta central */
.c-torre  { width: 21vw; aspect-ratio: 3 / 4;  left: 5vw;  top: 11vh;    transform: rotate(-7deg); z-index: 2; }
.c-fuente { width: 30vw; aspect-ratio: 4 / 3;  right: 4vw; top: 7vh;     transform: rotate(5deg);  z-index: 1; }
.c-noche  { width: 33vw; aspect-ratio: 16 / 9; left: 17vw; bottom: 5vh;  transform: rotate(3deg);  z-index: 3; }
/* móvil: arriba y abajo, solapadas en las esquinas */
@media (orientation: portrait) {
  .c-torre  { width: 46vw; left: -4vw;  top: 2vh;    transform: rotate(-8deg); }
  .c-fuente { width: 62vw; right: -6vw; top: 9vh;    transform: rotate(6deg); }
  .c-noche  { width: 86vw; left: 7vw;   bottom: 3vh; transform: rotate(-3deg); }
}
/* modo claro: delante las de día; oscuro: delante la ciudad de noche */
@media (prefers-color-scheme: light) { .c-noche { z-index: 1; filter: saturate(.9); } .c-torre { z-index: 3; } }
@media (prefers-color-scheme: dark) { .c-torre, .c-fuente { filter: brightness(.8) saturate(.9); } .c-noche { z-index: 3; } }
/* Dentro de la app el collage es solo ambiente: un velo mantiene el contenido legible. */
body.app::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 91%, transparent); }
body.auth { min-height: 100vh; }
body.auth main { padding-top: 12vh; position: relative; }
@media (orientation: portrait) { body.auth main { padding-top: 30vh; } }
body.auth header h1 { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); font-size: 1.7rem; }
body.auth main > p.muted { color: var(--text); background: color-mix(in srgb, var(--card) 75%, transparent); display: inline-block; padding: 4px 10px; border-radius: 8px; }
body.auth .card {
  background: color-mix(in srgb, var(--card) 84%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  border-color: color-mix(in srgb, var(--line) 60%, transparent); box-shadow: 0 16px 50px rgba(0,0,0,.3);
}
.topbar { background: color-mix(in srgb, var(--card) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.group-head { background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); padding: 6px 8px; margin-left: -8px; margin-right: -8px; border-radius: 8px; }
body.auth header h1 { color: var(--text); text-shadow: none; display: inline-block; padding: 4px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--card) 80%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
/* ordenador: las tres agrupadas y superpuestas a la izquierda; la tarjeta a la derecha */
@media (orientation: landscape) {
  .c-torre  { width: 19vw; left: 7vw;  top: 10vh; bottom: auto; right: auto; transform: rotate(-7deg); }
  .c-fuente { width: 27vw; left: 21vw; top: 6vh;  bottom: auto; right: auto; transform: rotate(6deg); }
  .c-noche  { width: 31vw; left: 12vw; top: 46vh; bottom: auto; right: auto; transform: rotate(-3deg); }
}
@media (orientation: landscape) and (min-width: 1000px) {
  body.auth main.narrow { margin-left: max(56vw, calc(100vw - 520px)); margin-right: 0; padding-top: 18vh; }
}
