/* Vault on the web, styled after iOS / macOS: system colours and type, inset grouped
   lists, large titles, frosted bars, sheets. Light and dark follow the system. */

:root {
  --bg: #f2f2f7;                       /* systemGroupedBackground */
  --cell: #ffffff;                     /* secondarySystemGroupedBackground */
  --cell-hi: #e5e5ea;
  --label: #000000;
  --label2: rgba(60, 60, 67, 0.6);     /* secondaryLabel */
  --label3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.29);
  --fill: rgba(120, 120, 128, 0.12);   /* tertiarySystemFill */
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --orange: #ff9500;
  --purple: #af52de;
  --pink: #ff2d55;
  --teal: #30b0c7;
  --bar: rgba(249, 249, 249, 0.82);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.07);
  --r: 12px;
  font: 17px/1.29 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  letter-spacing: -0.022em;
  color: var(--label);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --cell: #1c1c1e;
    --cell-hi: #2c2c2e;
    --label: #ffffff;
    --label2: rgba(235, 235, 245, 0.6);
    --label3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --blue: #0a84ff;
    --red: #ff453a;
    --green: #30d158;
    --orange: #ff9f0a;
    --purple: #bf5af2;
    --teal: #40c8e0;
    --bar: rgba(22, 22, 24, 0.8);
    --shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.06);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
svg { display: block; width: 100%; height: 100%; }

/* ---- Layout ---- */
.page { max-width: 720px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 40px; }
.shared { padding-top: 8px; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: 0.01em; margin: 0 0 6px; }
h2 { font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: 0.01em; margin: 6px 4px 14px; }
p { margin: 0 0 10px; }
.muted { color: var(--label2); }
.small { font-size: 13px; letter-spacing: -0.006em; }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: 0; color: var(--label2); margin: 18px 16px 7px; }
.note { white-space: pre-wrap; color: var(--label2); margin: 0 0 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Cards (inset grouped) ---- */
.card, .card-lite, .uploads {
  background: var(--cell);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card { padding: 6px 0; overflow: hidden; }
.card > .row, .card > h1, .card > .note, .card > .drop, .card > p { margin-left: 16px; margin-right: 16px; }
.card > h1 { margin-top: 12px; }
.card.center { text-align: center; padding: 36px 24px 28px; margin: 10vh auto 0; max-width: 440px; }
.card-lite { padding: 14px 16px; margin: 0 0 22px; }
.card-lite p { margin: 0 0 8px; }

/* ---- Buttons ---- */
button { font: inherit; letter-spacing: inherit; border: 0; background: none; color: var(--blue); cursor: pointer; padding: 8px 14px; border-radius: 10px; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--blue); color: #fff; font-weight: 600; }
button.primary:active:not(:disabled) { filter: brightness(0.9); }
button.ghost, label.button.ghost { background: var(--fill); color: var(--blue); font-weight: 500; }
button.ghost:active { background: var(--cell-hi); }
button.big { width: 100%; padding: 14px; font-size: 17px; border-radius: 14px; }
button.link, button.link-plain { padding: 0; border-radius: 0; text-align: left; }
button.link-plain { color: var(--label); }
.danger, button.danger { color: var(--red); }
.danger-btn { width: 100%; background: var(--fill); color: var(--red); font-weight: 500; padding: 12px; border-radius: 10px; margin-top: 6px; }
label.button { font: inherit; padding: 8px 14px; border-radius: 10px; cursor: pointer; display: inline-block; }
label.button input { display: none; }

/* ---- Navigation bar (from the folder trail: back to the parent, large title) ---- */
.toolbar { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; margin: 0 0 10px; }
.toolbar .actions { display: flex; gap: 8px; padding-bottom: 6px; }
.trail { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; }
.files .trail > .sep, .shared .trail > .sep { display: none; }
.files .trail > button, .shared .trail > button { display: none; }
.files .trail > button:nth-last-of-type(2), .shared .trail > button:nth-last-of-type(2) {
  display: inline-flex; align-items: center; gap: 2px; font-size: 17px; color: var(--blue); padding: 6px 0;
}
.files .trail > button:nth-last-of-type(2)::before, .shared .trail > button:nth-last-of-type(2)::before {
  content: ""; width: 12px; height: 20px; margin-right: 4px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'%3E%3Cpath d='M10 2 2 10l8 8' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'%3E%3Cpath d='M10 2 2 10l8 8' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.files .trail > button:last-of-type, .shared .trail > button:last-of-type {
  display: block; flex-basis: 100%; color: var(--label); font-size: 34px; font-weight: 700; letter-spacing: 0.01em;
  line-height: 1.2; padding: 2px 0; cursor: default; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shared .card > header.row { padding: 6px 16px 10px; align-items: end; }
.shared .card > header .trail > button:last-of-type { font-size: 28px; }

/* ---- Search field ---- */
.search, .inline input, .field input, input[type=password], input[type=text] {
  width: 100%; font: inherit; letter-spacing: inherit; padding: 9px 12px; border-radius: 10px;
  border: 0; background: var(--fill); color: var(--label); outline: none;
}
.search {
  padding-left: 34px; margin: 0 0 14px;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%238e8e93' stroke-width='2.2'/%3E%3Cpath d='m15.5 15.5 5 5' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") 10px center/17px no-repeat;
}
input::placeholder { color: var(--label2); }
input:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 35%, transparent); }
.inline { display: flex; gap: 8px; margin: 0 0 14px; }

/* ---- Lists (inset grouped rows, separators inset from the text) ---- */
.list { list-style: none; margin: 0; padding: 0; }
.app-page .list:not(.uploads), .card-lite .list { background: var(--cell); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card-lite .list { box-shadow: none; background: transparent; margin: 0 -16px; }
.item {
  position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto auto; align-items: center;
  gap: 12px; min-height: 52px; padding: 8px 16px;
}
.item::after { content: ""; position: absolute; left: 58px; right: 0; bottom: 0; height: 0.5px; background: var(--sep); }
.item:last-child::after { display: none; }
.list.single .item { min-height: 64px; }
.item.app-item { grid-template-columns: 30px minmax(0, 1fr) auto auto; }
.item:active { background: var(--cell-hi); }
.item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.app-item .name { white-space: normal; line-height: 1.25; }
.app-item .name .small { font-size: 13px; }
.item .meta { font-size: 15px; color: var(--label2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item button:not(.name) { font-size: 15px; padding: 6px 12px; }
.item button.more { color: var(--label2); font-size: 20px; padding: 2px 8px; letter-spacing: 0.08em; }
.empty { padding: 28px 16px; text-align: center; color: var(--label2); }
.empty::after { display: none; }
.item.device { grid-template-columns: 1fr auto; min-height: 44px; }
.item.device::after { left: 16px; }

/* Icons (SF Symbols style) */
.icon { width: 28px; height: 26px; color: var(--label2); }
.tint-folder { color: var(--blue); }
.tint-photo { color: var(--orange); }
.tint-film { color: var(--purple); }
.tint-music { color: var(--pink); }
.tint-pdf { color: var(--red); }
.tint-doc { color: var(--label2); }
.lock-ic { display: inline-block; width: 13px; height: 13px; vertical-align: -1px; margin-right: 4px; }

/* ---- Uploads ---- */
.uploads { list-style: none; padding: 2px 0; margin: 0 0 16px; }
.item.upload { grid-template-columns: minmax(0, 1fr) auto; min-height: 56px; gap: 4px 12px; }
.item.upload::after { left: 16px; }
.item.upload progress { grid-column: 1 / -1; width: 100%; height: 4px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 2px; background: var(--fill); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--fill); }
progress::-webkit-progress-value { background: var(--blue); border-radius: 2px; }
progress::-moz-progress-bar { background: var(--blue); }

/* ---- Forms ---- */
.pw { display: flex; gap: 8px; max-width: 340px; margin: 22px auto 10px; }
.pw input { flex: 1; }
.error { color: var(--red); font-size: 15px; }
.notice { margin: 12px 16px; color: var(--label2); font-size: 15px; }
.join .join-form { display: flex; flex-direction: column; gap: 14px; max-width: 340px; margin: 22px auto 10px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; }
.check { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.code { font: 600 44px ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; margin: 18px 0; }

/* ---- Footer ---- */
.foot { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; margin: 12px 16px; font-size: 13px; }
.lock { color: var(--label2); font-size: 13px; }

/* ---- File request drop zone ---- */
.drop {
  display: block; border: 2px dashed var(--label3); border-radius: 14px; padding: 34px 16px; text-align: center;
  cursor: pointer; margin: 10px 16px 14px; transition: background 0.15s, border-color 0.15s;
}
.drop strong { color: var(--blue); font-weight: 600; }
.drop.over { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.drop input { display: none; }

/* ---- Tab bar ---- */
.app-page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around;
  padding: 6px 10px max(10px, env(safe-area-inset-bottom));
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 500; letter-spacing: 0.01em; color: #8e8e93; padding: 2px 14px; border-radius: 0; }
.tab.on { color: var(--blue); }
.tab-icon { width: 27px; height: 25px; }

/* ---- Sheets, modals, toasts ---- */
.modal {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, 0.4); animation: fade 0.2s ease-out;
}
.modal-inner {
  background: var(--cell); border-radius: 16px; padding: 12px; max-width: min(1100px, 100%); max-height: 100%;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); animation: rise 0.25s ease-out;
}
.modal-inner .row { padding: 2px 4px; }
.modal-inner img, .modal-inner video { max-width: 100%; max-height: 78vh; border-radius: 10px; object-fit: contain; background: #000; }
.sheet-wrap { align-items: flex-end; padding: 8px; }
.sheet { width: min(500px, 100%); display: flex; flex-direction: column; gap: 8px; margin-bottom: env(safe-area-inset-bottom); animation: rise 0.25s ease-out; }
.sheet > :not(.ghost) { background: var(--bar); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.sheet-title { text-align: center; color: var(--label2); font-size: 13px; margin: 0; padding: 14px 16px 12px; border-radius: 14px 14px 0 0; border-bottom: 0.5px solid var(--sep); }
.sheet button { font-size: 20px; padding: 16px; border-radius: 0; border-bottom: 0.5px solid var(--sep); color: var(--blue); }
.sheet button.danger { color: var(--red); }
.sheet button:nth-last-child(2) { border-radius: 0 0 14px 14px; border-bottom: 0; }
.sheet button.ghost { background: var(--cell); border-radius: 14px; font-weight: 600; border: 0; margin-top: 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--label);
  padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  max-width: 90vw; animation: rise 0.25s ease-out;
}
pre.text { max-height: 70vh; overflow: auto; white-space: pre-wrap; font: 14px/1.45 ui-monospace, "SF Mono", Menlo, monospace; margin: 0; padding: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Wider screens (Mac browser) ---- */
@media (min-width: 760px) {
  .page { padding-top: 34px; }
  .item:hover:not(.empty) { background: color-mix(in srgb, var(--cell-hi) 55%, transparent); }
  .tabs { left: 50%; right: auto; transform: translateX(-50%); bottom: 16px; border-radius: 22px; border: 0.5px solid var(--sep); padding: 6px 12px; gap: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12); }
  .toast { bottom: 96px; }
}
