:root {
  color-scheme: light;
  --page: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f0f4f9;
  --surface-hover: #e8eef7;
  --surface-active: #dfe9fa;
  --border: #dde3eb;
  --border-strong: #c9d2df;
  --text: #1f2937;
  --text-strong: #111827;
  --muted: #667085;
  --muted-light: #98a2b3;
  --primary: #356ad8;
  --primary-hover: #285bc4;
  --primary-soft: #e8f0ff;
  --primary-softer: #f3f7ff;
  --danger: #c93636;
  --danger-hover: #ae2828;
  --danger-soft: #fce9e9;
  --success: #16845b;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(37, 48, 67, .12), 0 2px 6px rgba(37, 48, 67, .06);
  --shadow-lg: 0 24px 70px rgba(28, 39, 58, .16), 0 4px 16px rgba(28, 39, 58, .08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --topbar-height: 72px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
}

.hidden {
  display: none !important;
}

::selection {
  background: #cfe0ff;
  color: var(--text-strong);
}

:focus-visible {
  outline: 3px solid rgba(53, 106, 216, .28);
  outline-offset: 2px;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
  fill: currentColor;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.icon-button:hover {
  background: var(--surface-hover);
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 5px rgba(53, 106, 216, .2);
}

.primary-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(53, 106, 216, .24);
}

.primary-button:active,
.secondary-button:active,
.text-button:active {
  transform: translateY(1px);
}

.primary-button.danger {
  background: var(--danger);
  box-shadow: 0 2px 5px rgba(201, 54, 54, .18);
}

.primary-button.danger:hover {
  background: var(--danger-hover);
}

.primary-button:disabled {
  cursor: wait;
  opacity: .68;
  box-shadow: none;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--primary);
}

.secondary-button:hover {
  border-color: #aec2e8;
  background: var(--primary-softer);
}

.secondary-button svg,
.primary-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.text-button {
  background: transparent;
  color: var(--primary);
}

.text-button:hover {
  background: var(--primary-soft);
}

/* ---------- Authentication ---------- */
.auth-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 12% 12%, rgba(93, 145, 242, .13), transparent 30%),
    radial-gradient(circle at 88% 88%, rgba(53, 106, 216, .1), transparent 32%),
    var(--page);
}

.auth-card {
  display: grid;
  width: min(960px, 100%);
  min-height: 600px;
  overflow: hidden;
  grid-template-columns: 1.08fr .92fr;
  border: 1px solid rgba(201, 210, 223, .78);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: auth-card-in .46s cubic-bezier(.2, .8, .2, 1) both;
}

.auth-intro {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 44px 48px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .78), rgba(232, 240, 255, .4)),
    var(--primary-soft);
}

.auth-intro::before,
.auth-intro::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.auth-intro::before {
  top: -90px;
  right: -80px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(53, 106, 216, .12);
}

.auth-intro::after {
  right: -15px;
  bottom: -110px;
  width: 310px;
  height: 310px;
  background: rgba(255, 255, 255, .42);
}

.auth-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.35px;
}

.auth-copy {
  position: relative;
  z-index: 1;
  max-width: 390px;
  margin-top: 68px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 360px;
  color: var(--text-strong);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -1.7px;
}

.auth-copy > p:last-child {
  max-width: 360px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.auth-visual {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 1;
  min-height: 240px;
  place-items: end center;
  padding-bottom: 10px;
}

.visual-folder {
  position: relative;
  width: 250px;
  height: 158px;
  border-radius: 18px 18px 26px 26px;
  background: linear-gradient(145deg, #5d8deb, #356ad8);
  box-shadow: 0 24px 50px rgba(53, 106, 216, .25);
  transform: perspective(700px) rotateX(5deg) rotateY(-7deg);
  animation: visual-float 5s ease-in-out infinite;
}

.visual-folder::before {
  position: absolute;
  z-index: -1;
  top: -30px;
  left: 0;
  width: 104px;
  height: 62px;
  border-radius: 18px 18px 0 0;
  background: #4b7de0;
  content: "";
}

.visual-folder-tab {
  position: absolute;
  z-index: 1;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 13px 13px 20px 20px;
}

.visual-file {
  position: absolute;
  top: -48px;
  width: 98px;
  height: 128px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(42, 55, 78, .13);
}

.visual-file::before,
.visual-file::after {
  position: absolute;
  left: 18px;
  height: 6px;
  border-radius: 6px;
  background: #dce6f7;
  content: "";
}

.visual-file::before {
  top: 29px;
  width: 58px;
  box-shadow: 0 18px 0 #e7edf6, 0 36px 0 #e7edf6;
}

.visual-file::after {
  top: 83px;
  width: 38px;
}

.visual-file-one {
  left: 34px;
  transform: rotate(-7deg);
}

.visual-file-two {
  right: 35px;
  transform: rotate(8deg);
}

.visual-cloud {
  position: absolute;
  z-index: 3;
  top: 43px;
  left: 50%;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 22px;
  background: rgba(255, 255, 255, .92);
  color: var(--primary);
  box-shadow: 0 15px 28px rgba(26, 53, 108, .18);
  transform: translateX(-50%);
}

.visual-cloud svg {
  width: 45px;
  height: 45px;
  fill: currentColor;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 54px;
}

.auth-panel-heading {
  margin-bottom: 32px;
}

.auth-panel-heading h2 {
  color: var(--text-strong);
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -.65px;
}

.auth-panel-heading > p:last-child {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
}

.auth-mobile-mark {
  display: none;
  margin-bottom: 30px;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-form > label,
.dialog-field > label {
  margin-bottom: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.input-shell .field-icon {
  position: absolute;
  z-index: 1;
  left: 14px;
  width: 19px;
  height: 19px;
  fill: var(--muted-light);
  pointer-events: none;
  transition: fill .16s ease;
}

.input-shell input {
  width: 100%;
  height: 50px;
  padding: 0 52px 0 44px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  background: var(--surface);
  color: var(--text-strong);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.input-shell input::placeholder {
  color: var(--muted-light);
}

.input-shell input:hover {
  border-color: #abb7c7;
}

.input-shell input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(53, 106, 216, .12);
}

.input-shell:focus-within .field-icon {
  fill: var(--primary);
}

.field-action {
  position: absolute;
  right: 5px;
  width: 40px;
  height: 40px;
  color: var(--muted);
}

.field-action svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.error {
  min-height: 27px;
  padding-top: 7px;
  color: var(--danger);
  font-size: 12px;
}

.auth-submit {
  position: relative;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.auth-submit span {
  transition: opacity .16s ease;
}

.auth-submit svg {
  transition: transform .16s ease;
}

.auth-submit:hover svg {
  transform: translateX(3px);
}

.auth-submit.is-loading span,
.auth-submit.is-loading svg {
  opacity: 0;
}

.auth-submit.is-loading::after {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  animation: spin .7s linear infinite;
}

.auth-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
}

.auth-note svg {
  width: 15px;
  height: 15px;
  fill: var(--success);
}

/* ---------- Main shell ---------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--page);
  animation: app-in .32s ease-out both;
}

.topbar {
  position: relative;
  z-index: 50;
  display: grid;
  height: var(--topbar-height);
  align-items: center;
  grid-template-columns: 242px 1fr auto;
  padding: 0 18px;
  background: var(--page);
}

.brand {
  padding-left: 2px;
}

.brand-name {
  white-space: nowrap;
}

.topbar-context {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 8px;
  justify-self: start;
  padding: 8px 12px;
  border: 1px solid rgba(221, 227, 235, .9);
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ca675;
  box-shadow: 0 0 0 3px rgba(44, 166, 117, .1);
}

.user-box {
  position: relative;
  justify-self: end;
}

.account-button {
  display: flex;
  min-width: 168px;
  height: 52px;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 6px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color .16s ease;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  background: var(--surface-hover);
}

.user-avatar {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  background: linear-gradient(145deg, #5f8be4, #356ad8);
  color: #fff;
  box-shadow: 0 1px 3px rgba(53, 106, 216, .24);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-avatar.large {
  width: 44px;
  height: 44px;
  border-width: 0;
  font-size: 16px;
}

.account-copy {
  display: flex;
  min-width: 76px;
  flex: 1;
  flex-direction: column;
}

.user-name {
  overflow: hidden;
  max-width: 118px;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-label {
  color: var(--muted);
  font-size: 11px;
}

.chevron {
  width: 18px;
  height: 18px;
  fill: var(--muted);
  transition: transform .18s ease;
}

.account-button[aria-expanded="true"] .chevron,
.create-button[aria-expanded="true"] .create-chevron {
  transform: rotate(180deg);
}

.app-body {
  display: flex;
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  min-height: 0;
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  width: 242px;
  flex: 0 0 242px;
  flex-direction: column;
  padding: 14px 14px 22px;
}

.create-wrap {
  position: relative;
  width: max-content;
  margin-bottom: 22px;
}

.create-button {
  display: flex;
  width: 148px;
  height: 56px;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  border: 1px solid rgba(218, 225, 235, .76);
  border-radius: 17px;
  background: var(--surface);
  color: #263244;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-weight: 600;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.create-button:hover,
.create-button[aria-expanded="true"] {
  background: var(--primary-softer);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.create-button > svg:first-child {
  width: 25px;
  height: 25px;
  fill: var(--primary);
}

.create-chevron {
  width: 17px;
  height: 17px;
  margin-left: auto;
  fill: var(--muted);
  transition: transform .18s ease;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #475467;
  cursor: pointer;
  font-weight: 500;
  text-align: left;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
}

.nav-item.active {
  background: var(--primary-soft);
  color: #214d9a;
  font-weight: 650;
}

.nav-item:hover {
  background: #e9eff8;
}

.nav-item.active:hover {
  background: #dce8fb;
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: auto;
  padding: 15px 13px;
  border: 1px solid rgba(221, 227, 235, .9);
  border-radius: 16px;
  background: rgba(255, 255, 255, .58);
}

.sidebar-note-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-note-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.sidebar-note > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.sidebar-note strong {
  color: #344054;
  font-size: 11px;
  font-weight: 650;
}

.sidebar-note small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}

.workspace {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  margin: 0 16px 16px 0;
  border: 1px solid rgba(221, 227, 235, .74);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .025);
}

.workspace-header {
  display: flex;
  min-height: 72px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid #edf0f4;
}

.crumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}

.crumb {
  display: inline-flex;
  min-width: 0;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #344054;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}

.crumb:hover {
  background: var(--surface-soft);
  color: var(--text-strong);
}

.crumb.root {
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.35px;
}

.crumb.current {
  overflow: hidden;
  color: var(--text-strong);
  cursor: default;
  font-weight: 600;
  text-overflow: ellipsis;
}

.crumb.current:hover {
  background: transparent;
}

.crumb svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: var(--primary);
}

.crumb-separator {
  display: grid;
  width: 22px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted-light);
}

.crumb-separator svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.items-summary {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dropzone {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 24px 40px;
  scrollbar-color: #c7cfda transparent;
  scrollbar-width: thin;
}

.dropzone::-webkit-scrollbar {
  width: 10px;
}

.dropzone::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: #c7cfda;
  background-clip: padding-box;
}

.grid {
  min-height: 100%;
  transition: opacity .18s ease;
}

.content-section + .content-section {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.section-heading span {
  color: var(--muted-light);
  font-size: 11px;
}

.folder-grid,
.file-grid {
  display: grid;
  gap: 12px;
}

.folder-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.file-grid {
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 16px;
}

.item-card {
  position: relative;
  min-width: 0;
  border: 1px solid transparent;
  background: var(--surface-soft);
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
  animation: item-in .28s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: min(calc(var(--item-index, 0) * 24ms), 240ms);
}

.item-card:hover,
.item-card:focus-within {
  border-color: #d5dde8;
  background: #e9eef5;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.item-open {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.item-open:focus-visible {
  outline: 3px solid rgba(53, 106, 216, .3);
  outline-offset: -2px;
}

.folder-card {
  height: 58px;
  overflow: hidden;
  border-radius: 13px;
}

.folder-card .item-open {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 12px;
  padding: 0 48px 0 14px;
  border-radius: inherit;
}

.folder-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
}

.folder-icon svg {
  width: 100%;
  height: 100%;
}

.item-name {
  display: block;
  overflow: hidden;
  min-width: 0;
  color: #293548;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6b7a;
  cursor: pointer;
  opacity: .72;
  transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}

.folder-card .menu-btn {
  top: 10px;
  right: 7px;
}

.menu-btn:hover,
.menu-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, .82);
  color: var(--text-strong);
  opacity: 1;
}

.menu-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.file-card {
  min-height: 244px;
  overflow: hidden;
  border-radius: 15px;
}

.file-card .item-open {
  display: flex;
  height: 100%;
  min-height: 242px;
  flex-direction: column;
  border-radius: inherit;
}

.file-card-header {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 8px 46px 8px 12px;
}

.file-card-header .mini-file-icon {
  width: 19px;
  height: 23px;
  flex: 0 0 auto;
}

.file-card-header .item-name {
  font-size: 12.5px;
}

.file-card .menu-btn {
  top: 6px;
  right: 6px;
}

.file-preview {
  display: grid;
  min-height: 158px;
  flex: 1;
  margin: 0 7px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(212, 220, 231, .72);
  border-radius: 10px;
  background: var(--surface);
}

.file-preview .icon {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 158px;
  place-items: center;
}

.file-preview .file-icon-large {
  width: 55px;
  height: 65px;
  filter: drop-shadow(0 5px 7px rgba(41, 53, 72, .09));
}

.thumb-wrap {
  width: 100%;
  height: 100%;
  min-height: 158px;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%),
    #fff;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.thumb {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 158px;
  max-height: 190px;
  object-fit: cover;
  transition: transform .28s ease;
}

.file-card:hover .thumb {
  transform: scale(1.025);
}

.file-card-footer {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 9px;
  color: var(--muted);
  font-size: 10.5px;
}

.file-kind {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.empty {
  position: absolute;
  inset: 0;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 56px 20px 80px;
  text-align: center;
  animation: fade-in .28s ease both;
}

.empty-illustration {
  width: 136px;
  margin-bottom: 20px;
}

.empty-illustration svg {
  width: 100%;
}

.empty-folder-back {
  fill: #dfe9fa;
  stroke: #a9c1ee;
  stroke-width: 2;
}

.empty-folder-front {
  fill: #edf3ff;
  stroke: #a9c1ee;
  stroke-width: 2;
}

.empty-spark {
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-width: 2;
}

.empty h2 {
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 620;
  letter-spacing: -.2px;
}

.empty p {
  margin: 7px 0 21px;
  color: var(--muted);
}

.content-loading {
  position: absolute;
  z-index: 4;
  top: 45%;
  left: 50%;
  display: flex;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity .15s ease;
}

.content-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: loading-dot .9s ease-in-out infinite;
}

.content-loading span:nth-child(2) {
  animation-delay: .13s;
}

.content-loading span:nth-child(3) {
  animation-delay: .26s;
}

.dropzone.is-loading .grid,
.dropzone.is-loading .empty {
  opacity: .38;
  pointer-events: none;
}

.dropzone.is-loading .content-loading {
  opacity: 1;
}

.drop-overlay {
  position: fixed;
  z-index: 90;
  inset: calc(var(--topbar-height) + 16px) 16px 16px 258px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--primary);
  border-radius: var(--radius-xl);
  background: rgba(243, 247, 255, .94);
  opacity: 0;
  pointer-events: none;
  transform: scale(.985);
  transition: opacity .18s ease, transform .18s ease;
}

.dropzone.dragover .drop-overlay {
  opacity: 1;
  transform: scale(1);
}

.drop-overlay-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 30px;
  text-align: center;
}

.drop-overlay-card > span {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 17px;
  place-items: center;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
}

.drop-overlay-card svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.drop-overlay-card strong {
  color: var(--text-strong);
  font-size: 18px;
}

.drop-overlay-card small {
  margin-top: 6px;
  color: var(--muted);
}

/* ---------- Popovers and menus ---------- */
.popover {
  position: absolute;
  z-index: 120;
  min-width: 210px;
  padding: 7px;
  border: 1px solid rgba(210, 218, 229, .9);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--shadow-md);
  transform-origin: top;
  animation: menu-in .17s cubic-bezier(.2, .8, .2, 1) both;
}

.account-menu {
  top: calc(100% + 7px);
  right: 0;
  width: 250px;
}

.create-menu {
  top: calc(100% + 8px);
  left: 0;
  width: 228px;
}

.account-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 9px 12px;
}

.account-menu-header > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.account-menu-header strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.popover-separator {
  height: 1px;
  margin: 5px 3px;
  background: #edf0f4;
}

.popover-item {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #344054;
  cursor: pointer;
  text-align: left;
  transition: background-color .14s ease, color .14s ease;
}

.popover-item:hover,
.popover-item:focus-visible {
  background: var(--surface-soft);
  color: var(--text-strong);
}

.popover-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: var(--muted);
}

.ctx {
  position: fixed;
  z-index: 150;
  min-width: 210px;
  padding: 7px;
  border: 1px solid rgba(210, 218, 229, .9);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--shadow-md);
  transform-origin: top right;
  animation: menu-in .16s cubic-bezier(.2, .8, .2, 1) both;
}

.ctx button {
  display: flex;
  width: 100%;
  min-height: 41px;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #344054;
  cursor: pointer;
  text-align: left;
  transition: background-color .14s ease, color .14s ease;
}

.ctx button:hover,
.ctx button:focus-visible {
  background: var(--surface-soft);
  color: var(--text-strong);
}

.ctx button.danger {
  color: var(--danger);
}

.ctx button.danger:hover {
  background: var(--danger-soft);
}

.ctx button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

.ctx .ctx-separator {
  height: 1px;
  margin: 5px 3px;
  background: #edf0f4;
}

/* ---------- Upload and toast ---------- */
.upload-status {
  position: fixed;
  z-index: 180;
  right: 26px;
  bottom: 26px;
  width: min(360px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid rgba(210, 218, 229, .9);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: status-in .25s cubic-bezier(.2, .8, .2, 1) both;
}

.upload-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.upload-heading > span:first-child {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.upload-heading svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.upload-heading strong {
  display: block;
  color: var(--text-strong);
  font-size: 13px;
}

.upload-heading small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.upload-status .bar {
  height: 5px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.upload-status .bar > div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .2s ease;
}

.toast {
  position: fixed;
  z-index: 240;
  bottom: 25px;
  left: 50%;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border: 1px solid rgba(61, 73, 91, .55);
  border-radius: 12px;
  background: #263244;
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 24px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.2, .8, .2, 1);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Dialog ---------- */
.app-dialog {
  width: min(480px, calc(100vw - 30px));
  max-width: none;
  max-height: min(720px, calc(100dvh - 30px));
  padding: 0;
  overflow: visible;
  border: 0;
  outline: none;
  border-radius: 20px;
  background: transparent;
  color: var(--text);
}

.app-dialog::backdrop {
  background: rgba(23, 32, 46, .34);
  backdrop-filter: blur(3px);
  animation: backdrop-in .18s ease both;
}

.app-dialog[open] .dialog-card {
  animation: dialog-in .22s cubic-bezier(.2, .8, .2, 1) both;
}

.dialog-card {
  overflow: auto;
  max-height: min(720px, calc(100dvh - 30px));
  padding: 24px;
  border: 1px solid rgba(210, 218, 229, .88);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dialog-header {
  display: grid;
  align-items: start;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
}

.dialog-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.dialog-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.dialog-icon svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.dialog-header h2 {
  padding-top: 1px;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.2px;
}

.dialog-description {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.dialog-close {
  width: 34px;
  height: 34px;
  margin: -4px -4px 0 0;
  color: var(--muted);
}

.dialog-close svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.dialog-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 22px;
}

.dialog-fields:empty {
  display: none;
}

.dialog-field {
  display: flex;
  flex-direction: column;
}

.dialog-field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  outline: none;
  background: var(--surface);
  color: var(--text-strong);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.dialog-field input:hover {
  border-color: #abb7c7;
}

.dialog-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(53, 106, 216, .12);
}

.dialog-field input[readonly] {
  background: var(--surface-soft);
  color: #475467;
  cursor: text;
}

.dialog-field small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.dialog-error {
  min-height: 0;
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
}

.dialog-error:empty {
  display: none;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* ---------- Motion ---------- */
@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes app-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes visual-float {
  0%, 100% { transform: perspective(700px) rotateX(5deg) rotateY(-7deg) translateY(0); }
  50% { transform: perspective(700px) rotateX(5deg) rotateY(-7deg) translateY(-8px); }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes status-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes loading-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-7px); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 205px 1fr auto;
  }

  .sidebar {
    width: 205px;
    flex-basis: 205px;
  }

  .sidebar-note {
    display: none;
  }

  .drop-overlay {
    left: 221px;
  }

  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

@media (max-width: 820px) {
  .auth-card {
    width: min(540px, 100%);
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .auth-intro {
    display: none;
  }

  .auth-mobile-mark {
    display: inline-grid;
  }

  .auth-panel {
    min-height: 560px;
    padding: 52px;
  }

  .topbar {
    grid-template-columns: 174px 1fr auto;
  }

  .topbar-context {
    display: none;
  }

  .sidebar {
    width: 82px;
    flex-basis: 82px;
    align-items: center;
    padding-right: 10px;
    padding-left: 10px;
  }

  .create-wrap {
    width: 56px;
  }

  .create-button {
    width: 56px;
    justify-content: center;
    padding: 0;
  }

  .create-button > span,
  .create-button .create-chevron,
  .nav-item > span {
    display: none;
  }

  .create-menu {
    left: 0;
  }

  .side-nav {
    width: 100%;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .workspace {
    margin-right: 10px;
    margin-bottom: 10px;
  }

  .drop-overlay {
    right: 10px;
    bottom: 10px;
    left: 92px;
  }
}

@media (max-width: 600px) {
  :root {
    --topbar-height: 64px;
  }

  .auth-screen {
    padding: 14px;
  }

  .auth-card {
    border-radius: 22px;
  }

  .auth-panel {
    min-height: calc(100dvh - 28px);
    padding: 36px 26px;
  }

  .auth-panel-heading {
    margin-bottom: 28px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 11px 0 14px;
  }

  .brand {
    font-size: 20px;
  }

  .brand .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand .brand-mark svg {
    width: 24px;
    height: 24px;
  }

  .account-button {
    min-width: 0;
    width: 48px;
    height: 48px;
    justify-content: center;
    padding: 5px;
    border-radius: 14px;
  }

  .account-copy,
  .account-button .chevron {
    display: none;
  }

  .account-menu {
    top: calc(100% + 4px);
    right: 0;
  }

  .app-body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 68px;
    flex: 0 0 68px;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 6px 10px;
  }

  .create-wrap {
    width: auto;
    margin: 0;
  }

  .create-button {
    width: 136px;
    height: 50px;
    justify-content: flex-start;
    padding: 0 13px;
    border-radius: 15px;
  }

  .create-button > span,
  .create-button .create-chevron,
  .nav-item > span {
    display: initial;
  }

  .create-menu {
    top: calc(100% + 6px);
  }

  .side-nav {
    width: auto;
    flex: 1;
  }

  .nav-item {
    min-height: 44px;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 14px;
  }

  .workspace {
    min-height: 0;
    margin: 0 7px 7px;
    border-radius: 18px;
  }

  .workspace-header {
    min-height: 62px;
    padding: 9px 13px;
  }

  .crumb.root {
    font-size: 17px;
  }

  .crumb {
    height: 38px;
    padding: 0 7px;
    font-size: 14px;
  }

  .items-summary {
    display: none;
  }

  .dropzone {
    padding: 17px 13px 30px;
  }

  .drop-overlay {
    inset: 138px 7px 7px;
    border-radius: 18px;
  }

  .folder-grid {
    grid-template-columns: 1fr;
  }

  .file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .file-card {
    min-height: 218px;
  }

  .file-card .item-open {
    min-height: 216px;
  }

  .file-preview,
  .file-preview .icon,
  .thumb-wrap,
  .thumb {
    min-height: 135px;
  }

  .file-card-header {
    padding-left: 10px;
  }

  .upload-status {
    right: 16px;
    bottom: 16px;
  }

  .toast {
    bottom: 17px;
  }
}

@media (max-width: 390px) {
  .brand-name {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .create-button {
    width: 126px;
  }

  .nav-item {
    padding: 0 11px;
  }

  .file-card-header .mini-file-icon {
    display: none;
  }

  .file-card-header {
    padding-left: 10px;
  }

  .file-preview,
  .file-preview .icon,
  .thumb-wrap,
  .thumb {
    min-height: 122px;
  }

  .file-card {
    min-height: 204px;
  }

  .file-card .item-open {
    min-height: 202px;
  }

  .dialog-card {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
