:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1e1e1e;
  --border: #333;
  --text: #f0f0f0;
  --muted: #999;
  --accent: #4f8cff;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

/* Keep the hidden attribute working on elements that set their own display. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
}

main {
  max-width: 32rem;
  margin: 2rem auto;
  padding: 0 1rem;
}

main.wide { max-width: 72rem; }

h1 { margin-bottom: 1.5rem; }
h2 { font-size: 1rem; color: var(--muted); margin: 1.5rem 0 0.75rem; }

form { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.row { display: flex; gap: 0.5rem; flex-direction: row; align-items: center; }
.spread { justify-content: space-between; margin-bottom: 1rem; color: var(--muted); }
form.row input { flex: 1; }

input, button {
  font: inherit;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

input, textarea { background: var(--surface); color: var(--text); }
textarea {
  font: inherit;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  resize: vertical;
}

button, .button {
  font: inherit;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button.secondary, .button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.danger, .button.danger { color: var(--danger); }
button:disabled { opacity: 0.6; cursor: default; }
button.link { background: none; border: none; padding: 0; color: var(--accent); }
button.link:hover { text-decoration: underline; }
button.delete { background: transparent; border: none; color: var(--muted); padding: 0.2rem 0.5rem; }
button.delete:hover { color: var(--danger); }

ul { list-style: none; padding: 0; margin: 0; }

li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

li span { flex: 1; overflow-wrap: anywhere; }
li.done span { text-decoration: line-through; color: var(--muted); }

#error, .error-text { color: var(--danger); min-height: 1.5em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Android app download on the landing page */
.download-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.download-card h2 { color: var(--text); margin: 0 0 0.25rem; }
.download-card p { margin: 0 0 0.75rem; }
.download-card p.small { margin: 0.75rem 0 0; }
.download-card .button { display: inline-block; }
.download-icon { flex: none; width: 3rem; height: 3rem; }
#android-size { opacity: 0.8; margin-left: 0.4rem; font-size: 0.875rem; }
code.server-address { color: var(--text); overflow-wrap: anywhere; }
#topbar-download { text-decoration: none; }
#topbar-download:hover { color: var(--text); }

/* Top menu */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.menu { display: flex; gap: 0.25rem; }
.menu a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
}
.menu a:hover { color: var(--text); }
.menu a.active { color: var(--text); background: var(--surface); }

/* Images: Explorer-style window, navigation pane docked beside the content pane */
.images-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) 1fr;
  min-height: 70vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
@media (max-width: 720px) {
  .images-layout { grid-template-columns: 1fr; min-height: 0; }
  .tree-pane { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
}

.tree-pane {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0.75rem 0.5rem;
  overflow: auto;
}
.tree-pane h2 { margin: 0 0 0.5rem 0.5rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 1.1rem; }
.tree li { display: block; padding: 0; margin: 0; background: none; border: none; }
.tree-row { display: flex; align-items: center; border-radius: 4px; border: 1px solid transparent; }
.tree-row:hover { background: #262c36; }
.tree-row.selected { background: #2a3a5a; border-color: #3d5a8c; }
.tree-toggle, .tree-label {
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text);
  padding: 0.3rem 0.25rem;
  text-align: left;
}
.tree-toggle { width: 1.4rem; flex: none; color: var(--muted); font-size: 0.8rem; }
.tree-toggle:hover:not(:disabled) { color: var(--text); }
.tree-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.45rem; }
.tree-icon { display: inline-flex; flex: none; }
.tree-icon svg { width: 1.2rem; height: 1.2rem; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content-pane { min-width: 0; padding: 1rem 1.25rem; }
.breadcrumb {
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.folder-info h1 { margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.folder-info p { margin: 0.25rem 0; }
.toolbar { flex-wrap: wrap; margin: 1rem 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin: 0 0 1rem;
}
.panel h2 { margin-top: 0; }

/* View switch: Large icons / Details */
.view-controls { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; }
.sort-select { padding: 0.5rem; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.view-switch { display: flex; }
.view-switch button { display: inline-flex; align-items: center; padding: 0.55rem 0.65rem; color: var(--muted); }
.view-switch button:first-child { border-radius: 6px 0 0 6px; }
.view-switch button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.view-switch button:hover { color: var(--text); }
.view-switch button[aria-pressed='true'] { background: #2a3a5a; border-color: #3d5a8c; color: var(--text); }
.view-switch button[aria-pressed='true'] + button { border-left: none; }
.view-switch svg { width: 1rem; height: 1rem; fill: currentColor; }

/* Details view */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: normal; font-size: 0.9em; }
td:first-child { overflow-wrap: anywhere; }
.cell-name { display: flex; align-items: center; gap: 0.5rem; }
th.num, td.num { text-align: right; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #1f2630; }
tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tbody tr.selected { background: #2a3a5a; }
.row-icon { display: inline-flex; flex: none; }
.row-icon svg { width: 1.25rem; height: 1.25rem; }
.row-thumb { width: 1.25rem; height: 1.25rem; object-fit: cover; border-radius: 2px; }

/* Large icons view: icon above the name */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  white-space: normal;
  text-align: center;
}
.tile:hover { background: #1f2630; border-color: #2f3b4d; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile.selected { background: #2a3a5a; border-color: #3d5a8c; }
.tile-icon { display: flex; align-items: flex-end; justify-content: center; height: 4.5rem; }
.tile-icon svg { width: 4.5rem; height: 4.5rem; }
.tile-thumb {
  /* Whole image scaled to fit, like Explorer, so portrait photos are not cropped. */
  max-width: 4.5rem;
  max-height: 4.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.tile-name {
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image viewer: full-screen overlay */
dialog.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #0b0b0b;
  color: #fff;
}
dialog.viewer[open] { display: flex; flex-direction: column; }
dialog.viewer::backdrop { background: rgba(0, 0, 0, 0.6); }
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
}
.viewer-title { display: flex; align-items: baseline; gap: 0.75rem; min-width: 0; }
#viewer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#viewer-counter { white-space: nowrap; }
.viewer-bar .button, .viewer-bar button { border-color: rgba(255, 255, 255, 0.25); }
.viewer-close { font-size: 1.3rem; line-height: 1; padding: 0.45rem 0.75rem; }
.viewer-info-toggle, .viewer-fullscreen { display: inline-flex; align-items: center; gap: 0.35rem; }
.viewer-info-toggle svg, .viewer-fullscreen svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.viewer-info-toggle[aria-pressed="true"] { background: rgba(255, 255, 255, 0.2); }
.viewer-body { flex: 1; min-height: 0; display: flex; }
.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4.5rem 1rem;
  touch-action: pan-y pinch-zoom; /* horizontal swipes are ours */
}
.viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  transition: filter 0.2s;
}
.viewer-img:not([src]) { visibility: hidden; }
/* Thumbnail placeholder while the full image is decrypted */
.viewer-img.loading { width: 100%; height: 100%; filter: blur(12px); }
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.viewer-nav:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
.viewer-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viewer-nav:disabled { opacity: 0.2; }
.viewer-nav.prev { left: 1rem; }
.viewer-nav.next { right: 1rem; }
.viewer-nav svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.viewer-status {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: none;
  max-width: calc(100% - 2rem);
  text-align: center;
}
.viewer-status:empty { display: none; }
/* Info side panel: file details and the photo's EXIF data */
.viewer-info {
  flex: 0 0 18rem;
  overflow-y: auto;
  padding: 0 1rem 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  background: #141414;
  font-size: 0.9rem;
}
.viewer-info[hidden] { display: none; }
.viewer-info h2 { font-size: 1rem; margin: 0.75rem 0; }
.viewer-info h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
  margin: 1rem 0 0.4rem;
}
.viewer-info dl { margin: 0; }
.viewer-info dt { color: rgba(255, 255, 255, 0.6); margin-top: 0.4rem; }
.viewer-info dd { margin: 0; overflow-wrap: anywhere; }
.viewer-info a { color: #8ab4ff; }
/* Fullscreen mode: only the image, as large as it fits; controls fade out when idle */
.viewer-exit-fullscreen { display: none; }
dialog.viewer.immersive { background: #000; }
dialog.viewer.immersive .viewer-bar,
dialog.viewer.immersive .viewer-info { display: none; }
dialog.viewer.immersive .viewer-stage { padding: 0; }
dialog.viewer.immersive .viewer-img { width: 100%; height: 100%; }
dialog.viewer.immersive .viewer-exit-fullscreen {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}
.viewer-exit-fullscreen:hover { background: rgba(255, 255, 255, 0.22); }
.viewer-exit-fullscreen svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
dialog.viewer.immersive .viewer-nav { background: rgba(0, 0, 0, 0.45); }
dialog.viewer.immersive .viewer-nav,
dialog.viewer.immersive .viewer-exit-fullscreen { transition: opacity 0.3s; }
dialog.viewer.immersive.controls-hidden { cursor: none; }
dialog.viewer.immersive.controls-hidden .viewer-nav,
dialog.viewer.immersive.controls-hidden .viewer-exit-fullscreen { opacity: 0; pointer-events: none; }
@media (max-width: 720px) {
  .viewer-bar { flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0.75rem; }
  .viewer-title { flex: 1 1 100%; }
  .viewer-stage { padding: 0 0 0.75rem; }
  .viewer-body { flex-direction: column; }
  .viewer-info { flex: 0 1 auto; max-height: 50%; border-left: none; border-top: 1px solid rgba(255, 255, 255, 0.15); }
  .viewer-nav { background: rgba(0, 0, 0, 0.45); }
  .viewer-nav.prev { left: 0.5rem; }
  .viewer-nav.next { right: 0.5rem; }
}

/* Selecting images to move or delete */
.selection-bar { align-items: center; }
#selection-count { font-weight: 600; margin-right: 0.25rem; }
.tile { position: relative; }
.check { display: none; }
.select-mode .check {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.45);
}
.select-mode .tile .check { position: absolute; top: 0.4rem; left: 0.4rem; }
.checked .check { background: var(--accent); border-color: var(--accent); }
.checked .check::after { content: '✓'; color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1; }
.tile.checked { background: #2a3a5a; border-color: var(--accent); }
tbody tr.checked { background: #2a3a5a; }
.select-mode #file-list { user-select: none; }
/* Drop targets while dragging images onto a folder */
.drop-target, .tree-row.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: #22324d; }

/* Move dialog: pick a destination folder */
dialog.move-dialog { width: min(30rem, calc(100vw - 2rem)); }
.move-dialog form { display: flex; flex-direction: column; gap: 0.75rem; }
.move-tree {
  max-height: min(50vh, 24rem);
  overflow: auto;
  padding: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.move-new-row input { flex: 1; min-width: 0; }
.move-dialog .error-text:empty { display: none; }
.tree-label:disabled { color: var(--muted); cursor: default; }

/* Share dialog */
dialog.share-dialog { width: min(32rem, calc(100vw - 2rem)); }
.share-dialog form, #share-result { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }
.share-dialog label { display: flex; flex-direction: column; gap: 0.3rem; }
.share-dialog select { padding: 0.5rem; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.share-dialog .error-text:empty, .share-dialog [role='status']:empty { display: none; }
.share-note { font-size: 0.85rem; }
#share-link { font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* Shared link page (share.html) */
.share-page h1 { overflow-wrap: anywhere; margin-bottom: 0.25rem; }
.share-page #share-album-details { margin: 0 0 1rem; }
.share-message, .share-password { max-width: 26rem; margin: 3rem auto; }
.share-message h1, .share-password h1 { font-size: 1.3rem; }
.share-password .error-text:empty { display: none; }

/* Shared links: the owner's list and detail */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.shares-nav {
  display: flex; align-items: center; gap: 0.45rem; width: 100%;
  margin-bottom: 0.75rem; padding: 0.4rem 0.5rem;
  background: none; border: 1px solid transparent; border-radius: 4px; color: var(--text); text-align: left;
}
.shares-nav:hover { background: #262c36; }
.shares-nav.selected { background: #2a3a5a; border-color: #3d5a8c; }
.shares-nav svg { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.shares-count { margin-left: auto; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.danger-text { color: var(--danger); }
#shares-table td { vertical-align: middle; }
#shares-table tr.expired .share-title { color: var(--muted); }
.share-cell { display: flex; align-items: center; gap: 0.75rem; }
.share-previews { display: flex; gap: 2px; flex: none; min-width: 2.25rem; }
.share-preview { width: 2.25rem; height: 2.25rem; object-fit: cover; border-radius: 4px; background: var(--surface); }
.share-title { font-weight: 600; }
.share-sub { display: block; font-size: 0.8rem; }
.share-lock { display: inline-flex; vertical-align: -0.15em; margin-left: 0.35rem; }
.share-lock svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; }
.share-actions { white-space: nowrap; text-align: right; }
.share-actions > * + * { margin-left: 0.4rem; }
.share-actions .button, .share-actions button { padding: 0.35rem 0.7rem; font-size: 0.9rem; }
.share-panel h2 { margin: 0 0 0.6rem; }
.share-panel p { margin: 0 0 0.6rem; }
.share-link-row input, .share-password-row input { flex: 1; min-width: 0; }
#share-detail-link { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.share-password-row, .share-link-row { flex-wrap: wrap; }
.share-message-line { color: #7fd18b; min-height: 0; margin: 0 0 1rem; }
.share-message-line:empty { display: none; }
.share-panel select { padding: 0.5rem; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.share-stats { display: flex; gap: 2rem; margin: 0 0 1rem; }
.share-stats dt { color: var(--muted); font-size: 0.8rem; }
.share-stats dd { margin: 0; font-size: 1.4rem; }
/* Views per day: one series, thin columns from a single baseline */
.share-chart-figure { margin: 0; }
.share-chart-figure figcaption { font-size: 0.9rem; margin-bottom: 0.5rem; }
.share-chart-plot { position: relative; padding-left: 1.75rem; }
.chart-max { position: absolute; left: 0; top: -0.4rem; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.share-chart {
  display: flex; align-items: stretch; gap: 2px; height: 5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
}
.chart-slot { flex: 1; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px 4px 0 0; outline: none; }
.chart-slot.active, .chart-slot:focus-visible { background: rgba(255, 255, 255, 0.05); }
.chart-bar { width: 100%; max-width: 24px; background: var(--accent); border-radius: 4px 4px 0 0; }
.chart-tooltip {
  position: absolute; bottom: calc(100% + 0.3rem); transform: translateX(-50%);
  padding: 0.3rem 0.55rem; border-radius: 6px; background: #000; border: 1px solid var(--border);
  font-size: 0.8rem; white-space: nowrap; pointer-events: none;
}
.chart-axis { display: flex; justify-content: space-between; padding-left: 1.75rem; font-size: 0.75rem; margin-top: 0.25rem; }
.share-chart-table { margin-top: 0.75rem; font-size: 0.9rem; }
.share-chart-table summary { cursor: pointer; color: var(--muted); }
.share-chart-table td.num, .share-chart-table th.num { font-variant-numeric: tabular-nums; }
.share-items .tile { cursor: default; }
.share-item-remove { font-size: 0.8rem; padding: 0.25rem 0.6rem; }
@media (max-width: 720px) {
  #shares-table th:nth-child(2), #shares-table td:nth-child(2) { display: none; }
  .share-actions { white-space: normal; }
  .share-actions > * { margin: 0.2rem 0 0 0.4rem; }
}

/* Uploading: progress, and files dragged in from the computer */
.upload-progress { margin: 0 0 1rem; }
.upload-progress .row { justify-content: space-between; margin-bottom: 0.4rem; font-variant-numeric: tabular-nums; }
.upload-progress button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.file-drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: #22324d; }
#folder-view { position: relative; min-height: 100%; }
#folder-view.file-drop-target { background: rgba(79, 140, 255, 0.08); border-radius: 6px; }
#folder-view.file-drop-target::after {
  content: 'Drop to upload here';
  position: absolute; inset: auto 0 1rem; text-align: center; color: var(--accent); font-weight: 600; pointer-events: none;
}

/* "Shared in N links" */
.shared-badge { display: inline-flex; }
.shared-badge svg { width: 1rem; height: 1rem; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.tile .shared-badge {
  position: absolute; top: 0.35rem; right: 0.35rem; padding: 0.2rem; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
}
.cell-name .shared-badge { margin-left: 0.25rem; }
.viewer-shared { display: inline-flex; align-items: center; gap: 0.35rem; color: #8ab4ff; }
.viewer-shared svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Timeline: all images by photo date, in month sections */
#timeline-nav svg { stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; }
.timeline-section h2 { margin: 1.25rem 0 0.5rem; color: var(--text); font-size: 1rem; }
.timeline-section h2 .muted { font-weight: normal; font-size: 0.85rem; margin-left: 0.4rem; }
.timeline-progress:empty { display: none; }

/* Trash */
#trash-nav { margin-top: -0.5rem; }
#trash-nav svg { stroke: var(--muted); }
.trash-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.trash-grid .tile { cursor: default; }
.trash-sub { font-size: 0.75rem; }
.trash-item-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
.trash-item-actions button { font-size: 0.8rem; padding: 0.25rem 0.55rem; }

/* Storage usage below the folder tree */
.storage-usage { margin: 1.5rem 0.5rem 0; font-size: 0.85rem; }
.storage-text { margin-bottom: 0.35rem; font-variant-numeric: tabular-nums; }
.storage-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.storage-fill { height: 100%; border-radius: 2px; background: var(--accent); }
.storage-usage.near-full .storage-fill { background: var(--danger); }
.storage-usage.near-full #storage-used { color: var(--danger); }
.storage-usage + .key-settings-link { margin-top: 0.75rem; }

/* Account dialog */
.account-link { color: var(--muted); }
.account-link:hover { color: var(--text); }
dialog.account-dialog { width: min(30rem, calc(100vw - 2rem)); }
.account-dialog[open] { display: flex; flex-direction: column; gap: 0.75rem; }
.account-usage { display: flex; gap: 2rem; margin: 0; }
.account-usage dt { color: var(--muted); font-size: 0.8rem; }
.account-usage dd { margin: 0; font-variant-numeric: tabular-nums; }
.account-dialog h3 { margin: 0.5rem 0 0; font-size: 1rem; }
#account-delete-form { gap: 0.6rem; }
#account-delete-form .error-text:empty { display: none; }
#account-delete { align-self: flex-start; }

/* Master key: recovery code and settings */
.key-forgot { margin-top: 0.25rem; align-self: flex-start; font-size: 0.9rem; }
.key-settings-link { display: block; margin: 1.5rem 0 0 0.5rem; font-size: 0.85rem; }
dialog.recovery-dialog, dialog.key-settings { width: min(32rem, calc(100vw - 2rem)); }
.recovery-dialog { display: none; }
.recovery-dialog[open], .key-settings[open] { display: flex; flex-direction: column; gap: 0.75rem; }
.recovery-code {
  font-family: ui-monospace, monospace; font-size: 1.35rem; letter-spacing: 0.06em; text-align: center;
  padding: 0.9rem; border: 1px dashed var(--accent); border-radius: 6px; background: var(--bg);
  user-select: all; overflow-wrap: anywhere;
}
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-label input { width: auto; }
.recovery-dialog .error-text:empty, #key-error:empty { display: none; }
.key-settings form { display: flex; flex-direction: column; gap: 0.6rem; }
.key-settings h3 { margin: 0.5rem 0 0; font-size: 1rem; }
.key-recovery-section { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.status-text:empty { display: none; }
.status-text { color: #7fd18b; }
.status-text.error { color: var(--danger); }

/* Master key modal */
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  width: min(26rem, calc(100vw - 2rem));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
dialog form { margin: 0; }
dialog h2 { margin: 0; color: var(--text); font-size: 1.2rem; }
dialog p { margin: 0; }
