:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #65706b;
  --line: #dfe4e0;
  --surface: #ffffff;
  --canvas: #f6f7f4;
  --accent: #167c62;
  --accent-strong: #0e634e;
  --accent-soft: #dff1ea;
  --warning: #b64a3c;
  --focus: #227fba;
  --shadow: 0 12px 36px rgba(31, 49, 41, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
.upload-button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
.upload-button:focus-within {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-layout {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 390px);
  align-items: center;
  gap: 96px;
}

.brand-block {
  padding: 16px 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
  font-weight: 750;
}

.brand-mark.small {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  font-size: 14px;
}

.product-name {
  margin: 24px 0 10px;
  font-weight: 700;
  font-size: 15px;
}

.brand-block h1 {
  max-width: 460px;
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.08;
  font-weight: 720;
}

.brand-rule {
  width: 72px;
  height: 5px;
  margin-top: 30px;
  background: var(--accent);
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 28px;
  border-radius: 6px;
  background: #eef1ee;
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
}

.segment.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 30, 25, 0.12);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #38423e;
  font-size: 13px;
  font-weight: 650;
}

.field input,
.search-field input {
  width: 100%;
  border: 1px solid #ccd4cf;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input {
  height: 46px;
  padding: 0 13px;
}

.field input:focus,
.search-field input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(34, 127, 186, 0.11);
  outline: none;
}

.primary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.primary:active {
  transform: translateY(1px);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.65;
}

.wide {
  width: 100%;
}

.form-error {
  min-height: 20px;
  margin: -4px 0 12px;
  color: var(--warning);
  font-size: 13px;
}

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.brand-inline {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.account-menu {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 650;
  padding: 5px;
}

.text-button:hover {
  text-decoration: underline;
}

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

.workspace {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 46px 0 96px;
}

.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.workspace-heading h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.upload-button {
  height: 42px;
  padding: 0 17px;
}

.upload-button span {
  font-size: 21px;
  line-height: 1;
}

.storage-band {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.usage-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.usage-copy strong {
  color: var(--ink);
  font-weight: 700;
}

.usage-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8ece9;
}

.usage-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.file-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 26px 0 12px;
}

.search-field {
  width: min(360px, 100%);
}

.search-field input {
  height: 40px;
  padding: 0 13px;
}

.file-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.file-surface {
  min-height: 310px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-surface.dragging {
  border-color: var(--accent);
  background: #f5fbf8;
}

.table-header,
.file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 180px 250px;
  align-items: center;
  gap: 18px;
}

.table-header {
  min-height: 44px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.file-row {
  min-height: 66px;
  padding: 9px 20px;
  border-bottom: 1px solid #edf0ed;
}

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

.file-primary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-badge {
  width: 34px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #cad6d0;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.file-meta {
  color: var(--muted);
  font-size: 13px;
}

.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.file-action,
.secondary-button {
  min-width: 48px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid #ccd4cf;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.file-action:hover,
.secondary-button:hover {
  border-color: #9da9a2;
  background: #f3f5f3;
}

.file-action.danger {
  border-color: #e3c9c5;
  color: var(--warning);
}

.file-action.danger:hover {
  border-color: #cf9188;
  background: #fff7f5;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}

.empty-state p {
  margin: 12px 0 0;
}

.empty-glyph {
  width: 54px;
  height: 42px;
  border: 2px solid #bec8c2;
  border-radius: 5px;
  position: relative;
}

.empty-glyph::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -9px;
  width: 22px;
  height: 9px;
  border: 2px solid #bec8c2;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: var(--surface);
}

.upload-tray {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(380px, calc(100% - 32px));
  max-height: 52vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  z-index: 20;
}

.tray-heading,
.upload-item {
  padding: 13px 15px;
}

.tray-heading {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.tray-heading span {
  color: var(--muted);
  font-size: 12px;
}

.upload-item {
  border-bottom: 1px solid #edf0ed;
}

.upload-item:last-child {
  border-bottom: 0;
}

.upload-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}

.upload-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress {
  height: 4px;
  border-radius: 2px;
  background: #e7ebe8;
  overflow: hidden;
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 100ms linear;
}

.toast-region {
  position: fixed;
  left: 24px;
  bottom: 24px;
  display: grid;
  gap: 9px;
  z-index: 30;
}

.toast {
  max-width: 360px;
  padding: 12px 15px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.error {
  background: #8b352c;
}

body.preview-open {
  overflow: hidden;
}

.preview-backdrop,
.share-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(20, 28, 24, 0.72);
  z-index: 40;
}

.preview-dialog {
  width: min(1080px, 100%);
  height: min(760px, calc(100vh - 56px));
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(10, 18, 14, 0.32);
}

.share-dialog {
  width: min(560px, 100%);
  display: grid;
  grid-template-rows: 58px auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(10, 18, 14, 0.32);
}

.share-body {
  padding: 22px;
}

.share-file-name {
  margin: 0 0 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.share-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
}

.share-controls label {
  grid-column: 1 / -1;
  color: #38423e;
  font-size: 13px;
  font-weight: 650;
}

.share-controls select,
.share-controls input,
.share-url-row input {
  height: 42px;
  min-width: 0;
  border: 1px solid #ccd4cf;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.share-controls select {
  padding: 0 10px;
}

.share-controls input {
  width: 100%;
  padding: 0 10px;
}

.custom-duration {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.custom-duration label {
  grid-column: auto;
}

.share-controls .primary {
  padding: 0 16px;
}

.share-list-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.share-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.share-list-heading h3 {
  margin: 0;
  font-size: 13px;
}

.share-list-heading span {
  color: var(--muted);
  font-size: 12px;
}

.share-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
}

.share-list-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfa;
}

.share-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.share-url-row input {
  width: 100%;
  padding: 0 11px;
}

.share-url-row .secondary-button {
  height: 42px;
}

.share-result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.share-empty,
.legacy-share {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.legacy-share {
  padding: 7px 0;
}

.preview-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
}

.preview-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.icon-button:hover {
  background: #eef1ee;
  color: var(--ink);
}

.preview-content {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #eef1ee;
}

.preview-content img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-content iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.preview-content video {
  width: 100%;
  height: 100%;
  background: #101312;
}

.preview-content audio {
  width: min(560px, calc(100% - 40px));
}

.preview-content pre {
  align-self: stretch;
  justify-self: stretch;
  margin: 0;
  padding: 24px;
  overflow: auto;
  background: #fff;
  color: var(--ink);
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-status,
.preview-note {
  color: var(--muted);
  font-size: 13px;
}

.preview-note {
  position: absolute;
  right: 24px;
  bottom: 18px;
  margin: 0;
  padding: 6px 9px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
}

@media (max-width: 760px) {
  .auth-view {
    padding: 22px;
    place-items: start center;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .brand-block h1 {
    font-size: 36px;
  }

  .brand-rule {
    margin-top: 20px;
  }

  .auth-panel {
    padding: 24px;
  }

  .topbar {
    height: 58px;
    padding: 0 18px;
  }

  .user-name {
    display: none;
  }

  .workspace {
    width: min(100% - 28px, 1180px);
    padding-top: 30px;
  }

  .workspace-heading {
    align-items: center;
  }

  .storage-band {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .file-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .search-field {
    width: 100%;
  }

  .table-header {
    display: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 13px 14px;
  }

  .file-primary {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .file-meta.date {
    display: none;
  }

  .file-meta.size {
    grid-column: 2;
    justify-self: end;
  }

  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 46px;
  }

  .upload-tray {
    right: 16px;
    bottom: 16px;
  }

  .toast-region {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .preview-backdrop,
  .share-backdrop {
    padding: 0;
  }

  .preview-dialog {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .share-backdrop {
    place-items: end center;
  }

  .share-dialog {
    width: 100%;
    border-radius: 8px 8px 0 0;
  }

  .share-controls {
    grid-template-columns: 1fr;
  }

  .share-controls .primary {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
