:root {
  --ink: #14231c;
  --ink-soft: #4f5f56;
  --paper: #f5f3ec;
  --paper-deep: #e9e6dc;
  --white: #fffefa;
  --green: #28694c;
  --green-bright: #a6d965;
  --orange: #ef8354;
  --red: #b84b3a;
  --line: rgba(20, 35, 28, 0.12);
  --shadow: 0 20px 55px rgba(31, 47, 38, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(20, 35, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 35, 28, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(166, 217, 101, 0.75);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  width: 430px;
  height: 430px;
  top: -180px;
  right: -110px;
  background: rgba(166, 217, 101, 0.25);
}

.ambient-two {
  width: 360px;
  height: 360px;
  left: -190px;
  top: 48%;
  background: rgba(239, 131, 84, 0.14);
}

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 110px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--white);
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--green-bright);
  font-weight: 700;
}

.brand-mark.large {
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  font-size: 1.25rem;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions,
.toolbar-primary,
.toolbar-secondary,
.queue-actions,
.selection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.connection-badge::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d29a41;
  content: "";
}

.connection-badge.online::before {
  background: #51a46f;
  box-shadow: 0 0 0 4px rgba(81, 164, 111, 0.13);
}

.connection-badge.offline::before {
  background: var(--red);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 254, 250, 0.65);
  cursor: pointer;
  font-size: 1.3rem;
  transition: transform 180ms ease, background 180ms ease;
}

.icon-button:hover {
  transform: rotate(20deg);
  background: var(--white);
}

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 74px 0 34px;
  animation: reveal 500ms ease both;
}

.kicker {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 13px;
  font-size: clamp(2.5rem, 6vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

.breadcrumb-item {
  border: 0;
  padding: 4px 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
}

.breadcrumb-item:hover {
  color: var(--green);
}

.breadcrumb-separator {
  color: rgba(20, 35, 28, 0.3);
}

.stat-strip {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.72);
  backdrop-filter: blur(14px);
}

.stat-item {
  min-width: 112px;
  padding: 17px 20px;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--line);
}

.stat-item span,
.stat-item strong {
  display: block;
}

.stat-item span {
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.stat-item strong {
  font-size: 1.15rem;
}

.panel {
  border: 1px solid rgba(20, 35, 28, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 254, 250, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.upload-panel {
  padding: 12px;
  animation: reveal 500ms 80ms ease both;
}

.drop-zone {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  border: 1px dashed rgba(40, 105, 76, 0.35);
  border-radius: 15px;
  padding: 18px 22px;
  background:
    linear-gradient(120deg, rgba(166, 217, 101, 0.1), transparent 45%),
    rgba(245, 243, 236, 0.45);
  cursor: pointer;
  transition: border 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: rgba(166, 217, 101, 0.2);
  transform: scale(1.006);
}

.upload-glyph {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--green);
  font-size: 1.45rem;
}

.drop-copy strong,
.drop-copy span {
  display: block;
}

.drop-copy strong {
  margin-bottom: 5px;
  font-size: 1rem;
}

.drop-copy span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 17px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.primary {
  color: var(--white);
  background: var(--green);
}

.button.dark {
  color: var(--white);
  background: var(--ink);
}

.button.ghost {
  border-color: var(--line);
  background: rgba(255, 254, 250, 0.7);
}

.button.light {
  background: var(--white);
}

.button.danger {
  color: var(--white);
  background: var(--red);
}

.button.danger-text {
  color: var(--red);
  border-color: rgba(184, 75, 58, 0.22);
}

.button.compact {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 0.8rem;
}

.button.full {
  width: 100%;
}

.upload-queue {
  padding: 18px 14px 7px;
}

.queue-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.queue-summary strong,
.queue-summary span {
  display: block;
}

.queue-summary span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  margin-top: 15px;
  border-radius: 999px;
  background: var(--paper-deep);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green-bright);
  transition: width 180ms ease;
}

.browser-panel {
  margin-top: 20px;
  padding: 24px;
  animation: reveal 500ms 150ms ease both;
}

.browser-toolbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.browser-toolbar {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: flex;
  width: min(330px, 34vw);
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 13px;
  background: rgba(245, 243, 236, 0.65);
}

.search-box span {
  color: var(--ink-soft);
  font-size: 1.2rem;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: var(--white);
}

.content-section {
  padding-top: 26px;
}

.files-section {
  margin-top: 10px;
}

.section-heading {
  margin-bottom: 15px;
}

.section-heading > span {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.heading-with-check {
  display: flex;
  align-items: center;
  gap: 11px;
}

.folder-grid,
.file-grid {
  display: grid;
  gap: 14px;
}

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

.folder-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  color: var(--ink);
  background: rgba(245, 243, 236, 0.55);
  cursor: pointer;
  text-align: left;
  transition: transform 170ms ease, border 170ms ease, background 170ms ease;
}

.folder-card:hover {
  border-color: rgba(40, 105, 76, 0.35);
  background: var(--white);
  transform: translateY(-2px);
}

.folder-icon {
  position: relative;
  display: block;
  width: 43px;
  height: 34px;
  border-radius: 7px;
  background: #f4aa61;
}

.folder-icon::before {
  position: absolute;
  top: -6px;
  left: 3px;
  width: 18px;
  height: 9px;
  border-radius: 5px 5px 0 0;
  background: #e7984e;
  content: "";
}

.folder-info {
  min-width: 0;
}

.folder-info strong,
.folder-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-info small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.folder-arrow {
  color: var(--ink-soft);
}

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

.file-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
  transition: transform 180ms ease, box-shadow 180ms ease, border 180ms ease;
}

.file-card:hover {
  border-color: rgba(40, 105, 76, 0.28);
  box-shadow: 0 14px 30px rgba(31, 47, 38, 0.1);
  transform: translateY(-3px);
}

.file-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(40, 105, 76, 0.12);
}

.preview-button {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 0;
  padding: 0;
  background:
    linear-gradient(45deg, #e7e5de 25%, transparent 25%),
    linear-gradient(-45deg, #e7e5de 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7e5de 75%),
    linear-gradient(-45deg, transparent 75%, #e7e5de 75%),
    #f2f0e9;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  cursor: zoom-in;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 280ms ease;
}

.file-card:hover .preview-image {
  transform: scale(1.025);
}

.file-type {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 7px;
  padding: 4px 7px;
  color: var(--white);
  background: rgba(20, 35, 28, 0.72);
  backdrop-filter: blur(7px);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.check-control {
  display: inline-flex;
  cursor: pointer;
}

.check-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-control span {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid rgba(20, 35, 28, 0.28);
  border-radius: 6px;
  background: var(--white);
}

.check-control input:checked + span {
  border-color: var(--green);
  background: var(--green);
}

.check-control input:checked + span::after {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid white;
  border-left: 2px solid white;
  content: "";
  transform: rotate(-45deg) translateY(-1px);
}

.card-check {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
}

.file-info {
  padding: 13px 14px 14px;
}

.file-name,
.file-details {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name {
  font-size: 0.88rem;
}

.file-details {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.file-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.action-button {
  display: inline-flex;
  min-width: 0;
  min-height: 31px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 6px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 0.66rem;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-button:hover {
  color: var(--green);
  border-color: rgba(40, 105, 76, 0.3);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 52px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--ink-soft);
  background: rgba(245, 243, 236, 0.35);
  text-align: center;
}

.selection-bar {
  position: fixed;
  z-index: 20;
  right: 50%;
  bottom: 24px;
  display: flex;
  width: min(620px, calc(100% - 32px));
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 17px;
  padding: 12px 14px 12px 20px;
  color: var(--white);
  background: rgba(20, 35, 28, 0.94);
  box-shadow: 0 18px 50px rgba(20, 35, 28, 0.28);
  backdrop-filter: blur(16px);
  transform: translateX(50%);
  animation: rise 220ms ease both;
}

.text-button {
  border: 0;
  margin-left: 10px;
  padding: 0;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  cursor: pointer;
  font-size: 0.75rem;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 35, 28, 0.74);
  backdrop-filter: blur(12px);
}

.modal {
  width: min(430px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 23px;
  padding: 32px;
  background: var(--white);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.25);
  animation: modal-in 240ms ease both;
}

.modal h2 {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.modal p:not(.kicker):not(.form-error) {
  margin-bottom: 22px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.65;
}

.field {
  display: block;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--paper);
  outline: 0;
}

.field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(40, 105, 76, 0.1);
}

.form-error {
  min-height: 20px;
  margin: 7px 0 8px;
  color: var(--red);
  font-size: 0.75rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.preview-modal {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 30px;
  background: rgba(9, 16, 12, 0.92);
  backdrop-filter: blur(14px);
}

.preview-modal img {
  max-width: min(1200px, 94vw);
  max-height: calc(100vh - 130px);
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.preview-close {
  position: absolute;
  top: 22px;
  right: 25px;
  border: 0;
  color: white;
  background: transparent;
  cursor: pointer;
  font-size: 2rem;
}

.preview-caption {
  display: flex;
  width: min(700px, 94vw);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 18px;
  color: white;
}

.preview-caption strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-region {
  position: fixed;
  z-index: 80;
  top: 22px;
  right: 22px;
  display: grid;
  width: min(360px, calc(100% - 44px));
  gap: 9px;
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 13px 16px;
  color: white;
  background: rgba(20, 35, 28, 0.94);
  box-shadow: 0 12px 34px rgba(20, 35, 28, 0.2);
  font-size: 0.8rem;
  animation: toast-in 180ms ease both;
}

.toast.error {
  background: rgba(148, 52, 39, 0.96);
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translate(50%, 12px); }
  to { opacity: 1; transform: translate(50%, 0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 52px;
  }

  .stat-strip {
    width: 100%;
  }

  .stat-item {
    flex: 1;
    min-width: 0;
  }

  .browser-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-primary,
  .toolbar-secondary {
    flex-wrap: wrap;
  }

  .search-box {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1440px);
    padding-top: 14px;
  }

  .brand small,
  .connection-badge,
  #logoutBtn {
    display: none;
  }

  .workspace-head {
    padding-top: 42px;
  }

  h1 {
    font-size: 2.65rem;
  }

  .stat-item {
    padding: 13px 11px;
  }

  .stat-item strong {
    font-size: 0.95rem;
  }

  .drop-zone {
    grid-template-columns: auto 1fr;
    padding: 17px;
  }

  .drop-zone .button {
    grid-column: 1 / -1;
  }

  .browser-panel {
    padding: 16px;
  }

  .toolbar-primary,
  .toolbar-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-box {
    grid-column: 1 / -1;
    width: 100%;
  }

  .select {
    width: 100%;
  }

  .file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .folder-grid {
    grid-template-columns: 1fr;
  }

  .file-info {
    padding: 10px;
  }

  .file-actions {
    grid-template-columns: 1fr;
  }

  .action-button {
    min-height: 30px;
  }

  .selection-bar {
    bottom: 12px;
    padding-left: 14px;
  }

  .selection-bar .text-button {
    display: none;
  }

  .modal {
    padding: 26px 22px;
  }
}

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