:root {
  color-scheme: dark;
  --bg: #080c14;
  --window: rgba(13, 18, 30, 0.82);
  --window-solid: #111827;
  --sidebar: rgba(8, 13, 24, 0.82);
  --ink: #f3f7fb;
  --muted: #a8b3c2;
  --muted-2: #7f8da3;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.24);
  --blue: #5eb4ff;
  --blue-soft: rgba(94, 180, 255, 0.15);
  --blue-mid: rgba(94, 180, 255, 0.3);
  --danger: #ff6b7a;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
  --body-background:
    radial-gradient(circle at 8% 6%, rgba(94, 180, 255, 0.22), transparent 28rem),
    radial-gradient(circle at 92% 12%, rgba(49, 209, 178, 0.16), transparent 30rem),
    radial-gradient(circle at 50% 108%, rgba(10, 132, 255, 0.12), transparent 34rem),
    linear-gradient(180deg, #080c14 0%, #101827 100%);
  --shell-border: rgba(255, 255, 255, 0.14);
  --panel: rgba(255, 255, 255, 0.07);
  --panel-hover: rgba(255, 255, 255, 0.11);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --drive-bg: rgba(3, 7, 18, 0.3);
  --control-bg: rgba(15, 23, 42, 0.74);
  --control-hover: rgba(30, 41, 59, 0.94);
  --field-bg: rgba(15, 23, 42, 0.82);
  --list-bg: rgba(15, 23, 42, 0.52);
  --list-head-bg: rgba(255, 255, 255, 0.06);
  --status-bg: rgba(8, 13, 23, 0.72);
  --dialog-bg: rgba(15, 23, 42, 0.95);
  --dialog-backdrop: rgba(0, 0, 0, 0.5);
  --doc-background: linear-gradient(180deg, #f8fafc, #cbd5e1);
  --doc-border: rgba(255, 255, 255, 0.1);
  --doc-label: #475569;
  --radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Hiragino Sans", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --window: rgba(255, 255, 255, 0.78);
  --window-solid: #ffffff;
  --sidebar: rgba(245, 247, 250, 0.78);
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #8d8d92;
  --line: rgba(29, 29, 31, 0.12);
  --line-strong: rgba(29, 29, 31, 0.2);
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.12);
  --blue-mid: rgba(0, 113, 227, 0.22);
  --danger: #d70015;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.14);
  --body-background:
    radial-gradient(circle at 8% 6%, rgba(0, 113, 227, 0.2), transparent 28rem),
    radial-gradient(circle at 92% 12%, rgba(90, 200, 250, 0.18), transparent 30rem),
    linear-gradient(180deg, #fbfcff 0%, #eef2f7 100%);
  --shell-border: rgba(255, 255, 255, 0.64);
  --panel: rgba(255, 255, 255, 0.6);
  --panel-hover: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.72);
  --drive-bg: rgba(255, 255, 255, 0.42);
  --control-bg: rgba(255, 255, 255, 0.72);
  --control-hover: #ffffff;
  --field-bg: rgba(245, 246, 248, 0.92);
  --list-bg: rgba(255, 255, 255, 0.58);
  --list-head-bg: rgba(245, 246, 248, 0.74);
  --status-bg: rgba(245, 246, 248, 0.62);
  --dialog-bg: rgba(255, 255, 255, 0.92);
  --dialog-backdrop: rgba(0, 0, 0, 0.22);
  --doc-background: linear-gradient(180deg, #ffffff, #eef2f7);
  --doc-border: rgba(0, 0, 0, 0.06);
  --doc-label: var(--muted);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--body-background);
}

html,
body,
#app {
  min-width: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

input {
  border: 0;
  color: inherit;
  outline: none;
}

input::placeholder {
  color: var(--muted-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

svg.ui-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

code {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.login-card h1 {
  margin: 8px 0 10px;
  font-size: 2.6rem;
  letter-spacing: -0.06em;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.cloud-logo {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: linear-gradient(145deg, #0a84ff, #5ac8fa);
  box-shadow: 0 18px 34px rgba(0, 113, 227, 0.26);
  font-size: 1.7rem;
  font-weight: 800;
}

.cloud-logo.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1.1rem;
}

.eyebrow {
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.form input,
.dialog input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field-bg);
}

.form input:focus,
.dialog input:focus,
.search:focus-within {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.primary-button {
  padding: 13px 16px;
  border-radius: 12px;
  color: white;
  background: var(--blue);
  font-weight: 700;
}

.icloud-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  width: calc(100vw - 24px);
  height: calc(100dvh - 24px);
  min-height: 620px;
  margin: 12px auto;
  overflow: hidden;
  border: 1px solid var(--shell-border);
  border-radius: 26px;
  background: var(--window);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.sidebar-backdrop,
.icon-button.sidebar-toggle {
  display: none;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 10px;
}

.sidebar-brand strong,
.account-card strong {
  display: block;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand span,
.account-card span,
.sidebar-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
}

.sidebar-nav button {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 650;
  text-align: left;
}

.sidebar-nav button.active,
.sidebar-nav button:hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.nav-icon {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--blue);
  box-shadow: inset 0 -6px 0 rgba(255, 255, 255, 0.18);
}

.nav-icon.recent {
  border-radius: 999px;
  background: #34c759;
}

.nav-icon.photo {
  border-radius: 999px;
  background: linear-gradient(145deg, #ff9f0a, #ff375f 58%, #af52de);
}

.nav-icon.book {
  border-radius: 4px 8px 8px 4px;
  background: linear-gradient(145deg, #bf5af2, #5e5ce6);
}

.nav-icon.trash {
  border-radius: 5px 5px 7px 7px;
  background: #8e8e93;
}

.sidebar-card {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.account-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 9px;
  border-radius: 17px;
  background: var(--panel-strong);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: linear-gradient(145deg, #515154, #9a9aa1);
  font-weight: 800;
}

.logout-link {
  grid-column: 1 / -1;
  color: var(--blue);
  font-size: 0.82rem;
  text-align: left;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--control-bg);
  font-size: 0.78rem;
  font-weight: 700;
}

.theme-toggle.icon-theme-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
}

.theme-toggle.icon-theme-toggle svg.ui-icon {
  width: 18px;
  height: 18px;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--control-hover);
}

.theme-toggle:focus-visible,
.toolbar-button:focus-visible,
.icon-button:focus-visible,
.segmented button:focus-visible,
.sidebar-nav button:focus-visible,
.list-row:focus-visible,
.file-card:focus-visible,
.photo-tile:focus-visible {
  outline: 3px solid var(--blue-mid);
  outline-offset: 2px;
}

.login-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
}

.topbar-theme-toggle {
  min-height: 34px;
  white-space: nowrap;
}

.account-theme-toggle {
  grid-column: 1 / -1;
  justify-self: start;
}

.drive-window {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--drive-bg);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items: center;
  min-height: 84px;
  padding: 16px 24px 12px;
}

.nav-cluster {
  display: flex;
  gap: 8px;
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--blue);
  background: var(--control-bg);
}

.title-stack {
  min-width: 0;
}

.title-stack h1 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(1.9rem, 3.2vw, 3.6rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumb button {
  color: var(--blue);
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 0.78rem;
  font-weight: 650;
}

.header-meta span + span::before {
  margin-right: 10px;
  color: var(--line-strong);
  content: "/";
}

.search {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--field-bg);
}

.search span {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 999px;
}

.search span::after {
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 99px;
  background: var(--muted);
  content: "";
  transform: rotate(45deg);
}

.search input {
  width: 100%;
  background: transparent;
}

.actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 16px;
}

.photos-actionbar {
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.03));
}

.action-left,
.action-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.toolbar-button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--control-bg);
  font-size: 0.88rem;
  font-weight: 650;
}

.toolbar-button.icon-only {
  position: relative;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
}

.toolbar-button.icon-only svg.ui-icon {
  width: 19px;
  height: 19px;
}

.toolbar-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--control-hover);
}

.toolbar-button.primary {
  border-color: var(--blue);
  color: white;
  background: var(--blue);
}

.toolbar-button.primary:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: var(--control-bg);
}

.toolbar-button.danger {
  color: var(--danger);
}

.segmented {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--control-bg);
}

.segmented button {
  display: grid;
  width: 38px;
  height: 36px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.segmented button.active {
  color: white;
  background: var(--blue);
}

.photo-size-control {
  display: grid;
  grid-template-columns: 18px minmax(112px, 170px) 22px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--control-bg);
}

.photo-aspect-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
}

.photo-aspect-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  color: var(--muted);
}

.photo-aspect-button svg.ui-icon {
  width: 15px;
  height: 15px;
}

.photo-aspect-button.active {
  color: white;
  background: var(--blue);
}

.photo-aspect-button:not(.active):hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.photo-size-icon {
  display: grid;
  place-items: center;
}

.photo-size-icon.small svg.ui-icon {
  width: 14px;
  height: 14px;
}

.photo-size-icon.large svg.ui-icon {
  width: 20px;
  height: 20px;
}

.photo-size-control input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
  cursor: pointer;
}

.photo-size-control:focus-within {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  margin: 0 2px;
  background: var(--line);
}

.file-input {
  display: none;
}

.upload-pill,
.error.banner {
  margin: 14px 24px 0;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 650;
}

.error {
  margin-top: 14px;
  color: var(--danger);
}

.error.banner {
  background: rgba(215, 0, 21, 0.08);
  color: var(--danger);
}

.drop-surface {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: clamp(16px, 2vw, 30px);
}

.drop-surface.dragging {
  outline: 3px solid var(--blue-mid);
  outline-offset: -12px;
  background: var(--blue-soft);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(134px, 1fr));
  gap: 18px;
}

.photo-library {
  padding-bottom: 24px;
}

.photo-library-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.photo-library-title {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 780;
  letter-spacing: -0.03em;
}

.photo-library-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--photo-tile-size, 150px), var(--photo-tile-size, 150px)));
  gap: 10px;
  align-items: start;
  justify-content: start;
}

.photo-tile {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
}

.photo-tile:hover {
  border-color: var(--blue-mid);
}

.photo-tile.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-mid);
}

.photo-tile.selected::after {
  position: absolute;
  right: 7px;
  top: 7px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: white;
  background: var(--blue);
  content: "";
  font-size: 0.82rem;
  font-weight: 900;
}

.photo-tile.selected::before {
  position: absolute;
  z-index: 1;
  top: 13px;
  right: 16px;
  width: 8px;
  height: 4px;
  border-bottom: 2px solid white;
  border-left: 2px solid white;
  content: "";
  transform: rotate(-45deg);
}

.book-library {
  padding-bottom: 24px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 170px));
  gap: 22px 18px;
  align-items: start;
}

.book-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 18px;
  color: var(--ink);
  text-align: center;
}

.book-card:hover {
  background: var(--panel-hover);
}

.book-card.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.book-cover {
  position: relative;
  display: grid;
  width: min(100%, 148px);
  aspect-ratio: 0.68;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border-radius: 10px 14px 14px 10px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 9px, transparent 10px),
    linear-gradient(145deg, #bf5af2, #5e5ce6 58%, #0a84ff);
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.2);
}

.book-cover .file-glyph.folder {
  transform: scale(0.9);
}

.book-cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  object-fit: cover;
  transition: opacity 0.18s ease;
}

.book-cover-image.loaded {
  opacity: 1;
}

.book-cover-placeholder {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.16);
}

.book-title {
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1.24;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-meta {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.photo-frame {
  position: relative;
  display: grid;
  min-height: calc(var(--photo-tile-size, 150px) * 0.72);
  place-items: center;
}

.photo-library.square .photo-frame {
  aspect-ratio: 1;
  min-height: 0;
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.74);
  background:
    radial-gradient(circle at 30% 18%, rgba(94, 180, 255, 0.32), transparent 38%),
    linear-gradient(145deg, rgba(255, 159, 10, 0.7), rgba(255, 55, 95, 0.6), rgba(94, 92, 230, 0.7));
}

.photo-placeholder svg.ui-icon {
  width: 30px;
  height: 30px;
  stroke-width: 1.5;
}

.photo-frame.loaded .photo-placeholder {
  display: none;
}

.photo-preview {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.05), transparent 46%),
    rgba(0, 0, 0, 0.16);
  transition: opacity 160ms ease;
}

.photo-library.square .photo-preview {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
}

.photo-preview.loaded {
  opacity: 1;
}

.photo-video-badge {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.photo-video-badge svg.ui-icon {
  width: 16px;
  height: 16px;
  margin-left: 1px;
}

.file-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 146px;
  padding: 16px 10px 12px;
  border: 1px solid transparent;
  border-radius: 18px;
  text-align: center;
}

.file-card:hover,
.file-card.selected,
.list-row:hover,
.list-row.selected {
  border-color: var(--blue-mid);
  background: var(--blue-soft);
}

.file-card.selected,
.list-row.selected {
  box-shadow: inset 0 0 0 1px var(--blue-mid);
}

.file-glyph {
  position: relative;
  display: block;
  width: 68px;
  height: 54px;
  border-radius: 10px;
  background: linear-gradient(180deg, #5eb4ff, #0a84ff);
  box-shadow: 0 12px 22px rgba(0, 113, 227, 0.22);
}

.file-glyph.folder::before {
  position: absolute;
  top: -9px;
  left: 8px;
  width: 30px;
  height: 14px;
  border-radius: 8px 8px 0 0;
  background: #78c4ff;
  content: "";
}

.file-glyph.photos {
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 30%, #fff 0 8%, transparent 9%),
    radial-gradient(circle at 72% 34%, #ffd60a 0 14%, transparent 15%),
    linear-gradient(145deg, #ff9f0a, #ff375f 52%, #5e5ce6);
}

.file-glyph.photos::after {
  position: absolute;
  right: 10px;
  bottom: 9px;
  left: 10px;
  height: 18px;
  border-radius: 12px 12px 6px 6px;
  background: rgba(255, 255, 255, 0.32);
  content: "";
}

.file-glyph.books {
  border-radius: 8px 14px 14px 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 8px, transparent 9px),
    linear-gradient(145deg, #bf5af2, #5e5ce6 62%, #0a84ff);
}

.file-glyph.books::after {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 18px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 -10px 0 rgba(255, 255, 255, 0.42);
  content: "";
}

.file-glyph.file,
.file-glyph.text,
.file-glyph.pdf,
.file-glyph.image,
.file-glyph.video {
  width: 50px;
  height: 64px;
  border: 1px solid var(--doc-border);
  border-radius: 9px;
  background: var(--doc-background);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.file-glyph.pdf::after,
.file-glyph.text::after,
.file-glyph.image::after,
.file-glyph.video::after,
.file-glyph.file::after {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 9px;
  color: var(--doc-label);
  content: "FILE";
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.file-glyph.pdf::after {
  color: #ff3b30;
  content: "PDF";
}

.file-glyph.text::after {
  content: "TXT";
}

.file-glyph.image::after {
  color: #34c759;
  content: "IMG";
}

.file-glyph.video::after {
  color: #af52de;
  content: "MOV";
}

.file-glyph.mini {
  width: 26px;
  height: 22px;
  border-radius: 5px;
  box-shadow: none;
}

.file-glyph.mini.file,
.file-glyph.mini.text,
.file-glyph.mini.pdf,
.file-glyph.mini.image,
.file-glyph.mini.video {
  width: 22px;
  height: 28px;
  border-radius: 5px;
}

.file-glyph.mini::before,
.file-glyph.mini::after {
  display: none;
}

.file-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.list-view {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--list-bg);
}

.list-head,
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 220px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.list-head {
  color: var(--muted);
  background: var(--list-head-bg);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.list-row {
  min-height: 54px;
  background: transparent;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-name {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.list-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 1.3rem;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--dialog-backdrop);
  backdrop-filter: blur(10px);
}

.dialog {
  width: min(380px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--dialog-bg);
  box-shadow: var(--shadow);
}

.dialog h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

@media (min-width: 1800px) {
  .icloud-shell {
    grid-template-columns: 272px minmax(0, 1fr);
  }

  .icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  }
}

@media (max-width: 1180px) {
  .icloud-shell {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .icloud-shell {
    grid-template-columns: 1fr;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    border-radius: 0;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: min(320px, 86vw);
    min-height: 100dvh;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 14px calc(18px + env(safe-area-inset-bottom, 0px));
    border-right: 1px solid var(--line-strong);
    box-shadow: 28px 0 80px rgba(0, 0, 0, 0.42);
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .icloud-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    backdrop-filter: blur(4px);
  }

  .icloud-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .icon-button.sidebar-toggle {
    display: grid;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: auto;
    padding: 12px 14px 8px;
  }

  .nav-cluster .icon-button {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .search {
    padding: 7px 10px;
    border-radius: 11px;
  }

  .search {
    grid-column: 1 / -1;
  }

  .actionbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
    gap: 5px;
    padding: 0 14px 7px;
  }

  .action-left,
  .action-right {
    width: auto;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 1px 0 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .action-left::-webkit-scrollbar,
  .action-right::-webkit-scrollbar {
    display: none;
  }

  .toolbar-button.icon-only,
  .theme-toggle.icon-theme-toggle {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 12px;
  }

  .toolbar-button.icon-only svg.ui-icon {
    width: 17px;
    height: 17px;
  }

  .segmented {
    flex: 0 0 auto;
    border-radius: 12px;
  }

  .segmented button {
    width: 36px;
    height: 34px;
  }

  .photos-actionbar .action-right {
    display: grid;
    grid-template-columns: repeat(3, 36px) auto minmax(86px, 1fr);
    overflow: visible;
    gap: 6px;
    align-items: center;
    padding-bottom: 0;
  }

  .photo-aspect-control,
  .photo-size-control {
    width: auto;
    box-sizing: border-box;
  }

  .photo-aspect-control {
    justify-content: flex-start;
    padding: 3px;
  }

  .photo-aspect-button {
    width: 30px;
    height: 28px;
    min-height: 28px;
  }

  .photo-size-control {
    min-width: 0;
    min-height: 34px;
    padding: 0 7px;
    grid-template-columns: 14px minmax(0, 1fr) 18px;
    gap: 5px;
  }

  .photo-size-icon.small svg.ui-icon {
    width: 12px;
    height: 12px;
  }

  .photo-size-icon.large svg.ui-icon {
    width: 17px;
    height: 17px;
  }

  .toolbar-divider {
    display: none;
  }

  .drop-surface {
    padding: 14px;
  }

  .title-stack h1 {
    font-size: clamp(1.7rem, 8vw, 2.6rem);
  }

  .breadcrumb {
    margin-top: 5px;
  }

  .header-meta {
    gap: 8px;
    margin-top: 4px;
    font-size: 0.72rem;
  }

  .header-meta span + span::before {
    margin-right: 8px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(var(--photo-tile-size, 150px), 42vw), min(var(--photo-tile-size, 150px), 42vw)));
  }

  .list-head,
  .list-row {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .list-head span:nth-child(3),
  .list-row > span:nth-child(3) {
    display: none;
  }

}

@media (max-width: 520px) {
  .nav-cluster {
    gap: 6px;
  }

  .topbar-theme-toggle {
    display: none;
  }

  .topbar {
    gap: 8px;
    padding: 10px 10px 6px;
  }

  .nav-cluster .icon-button {
    width: 34px;
    height: 34px;
  }

  .actionbar {
    padding: 0 10px 6px;
  }

  .toolbar-button.icon-only,
  .theme-toggle.icon-theme-toggle {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .photos-actionbar .action-right {
    grid-template-columns: repeat(3, 34px) auto minmax(82px, 1fr);
    gap: 5px;
  }

  .photo-aspect-button {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .photo-size-control {
    min-height: 32px;
    padding: 0 6px;
    grid-template-columns: 12px minmax(0, 1fr) 16px;
  }

  .segmented button {
    width: 34px;
    height: 32px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(var(--photo-tile-size, 150px), 44vw), 1fr));
  }
}
