:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #eef2f7;
  line-height: 1.5;
  font-weight: 400;

  /* Sky Blue Theme Tokens */
  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;
  --sky-800: #075985;
  --sky-900: #0c4a6e;
  --sky-glow: rgba(2, 132, 199, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #eef2f7;
  color: #172033;
}

button, input, select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #111827;
  color: #dbe3f0;
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #202b3d;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--sky-600), var(--sky-400));
  display: grid;
  place-items: center;
  color: white;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 8px 24px var(--sky-glow);
}

.brand-mark span {
  color: var(--sky-200);
}

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

.brand strong {
  font-size: 16px;
  color: #fff;
}

.brand small {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: .16em;
  color: #8792a6;
}

.side-section-title {
  font-size: 10px;
  letter-spacing: .14em;
  color: #738095;
  font-weight: 700;
  padding: 12px 10px 7px;
}

.folder-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-button, .icon-button, .row-action {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.mini-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #95a2b7;
}

.mini-button:hover, .icon-button:hover, .row-action:hover {
  background: #ffffff10;
  color: #fff;
}

.nav-item, .tree-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #aeb9ca;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 10px 11px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}

.nav-item:hover, .tree-item:hover {
  background: #182235;
  color: #fff;
}

.nav-item.active, .tree-item.active {
  background: var(--sky-600);
  color: #fff;
  box-shadow: 0 4px 14px var(--sky-glow);
}

.nav-item.active .nav-count, .tree-item.active .nav-count {
  background: var(--sky-700);
  color: #fff;
}

.nav-icon {
  width: 20px;
  text-align: center;
}

.nav-count {
  margin-left: auto;
  background: #33405a;
  color: #d7deeb;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px;
}

.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 42vh;
  overflow: auto;
}

.tree-item {
  font-size: 13px;
  min-height: 36px;
  padding-top: 8px;
  padding-bottom: 8px;
}

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

.sidebar-spacer {
  flex: 1;
}

.account-card {
  margin-top: 14px;
  border-top: 1px solid #263144;
  padding: 16px 10px 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 4px #64748b20;
}

.status-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 0 4px #22c55e20;
}

.account-card div {
  min-width: 0;
}

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

.account-card strong {
  font-size: 12px;
  color: #f8fafc;
}

.account-card small {
  font-size: 10px;
  color: #8290a5;
}

.main {
  min-width: 0;
}

.topbar {
  height: 62px;
  background: #fff;
  border-bottom: 1px solid #dde3ec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.breadcrumbs button {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 4px 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumbs button:last-child {
  color: #111827;
  font-weight: 700;
}

.breadcrumbs span {
  color: #a0a9b8;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-status {
  font-size: 12px;
  color: #7a8494;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: #667085;
  font-size: 18px;
}

.icon-button:hover {
  background: #f1f5f9;
  color: #111827;
}

.content {
  max-width: 1450px;
  margin: 0 auto;
  padding: 30px 30px 50px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--sky-600);
  font-weight: 800;
}

.page-head h1 {
  font-size: 30px;
  letter-spacing: -.025em;
  margin: 6px 0 5px;
  color: #101828;
}

.page-head p {
  margin: 0;
  color: #667085;
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 10px;
}

.primary-button, .secondary-button {
  min-height: 42px;
  border-radius: 11px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, box-shadow .15s, transform .15s;
}

.primary-button {
  background: var(--sky-600);
  color: white;
  box-shadow: 0 5px 16px var(--sky-glow);
}

.primary-button:hover {
  background: var(--sky-700);
}

.secondary-button {
  background: #fff;
  border-color: #d7dee8;
  color: #344054;
}

.secondary-button:hover {
  background: #f8fafc;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stats-grid article {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px #0f172a08;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--sky-50);
  color: var(--sky-600);
  border: 1px solid var(--sky-100);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.stats-grid small, .stats-grid strong {
  display: block;
}

.stats-grid small {
  color: #7a8494;
  font-size: 11px;
}

.stats-grid strong {
  color: #101828;
  margin-top: 2px;
  font-size: 18px;
}

.explorer-card {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 15px;
  box-shadow: 0 4px 18px #0f172a0b;
  overflow: hidden;
}

.explorer-toolbar {
  display: flex;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid #e9edf3;
}

.search-box {
  min-width: 240px;
  flex: 1;
  height: 40px;
  border: 1px solid #d8dfe9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #8892a4;
  background: #fafbfc;
  transition: border-color .15s, box-shadow .15s;
}

.search-box:focus-within {
  border-color: var(--sky-400);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
  background: #fff;
}

.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
  width: 100%;
  color: #1f2937;
}

.explorer-toolbar select, .modal select {
  height: 40px;
  border: 1px solid #d8dfe9;
  border-radius: 10px;
  background: #fff;
  color: #475467;
  padding: 0 34px 0 11px;
  outline: 0;
}

.list-head, .item-row {
  display: grid;
  grid-template-columns: minmax(280px, 2.2fr) minmax(100px, .75fr) minmax(95px, .65fr) minmax(110px, .8fr) minmax(170px, 1fr);
  align-items: center;
  gap: 14px;
}

.list-head {
  min-height: 39px;
  padding: 0 16px;
  background: #fafbfc;
  border-bottom: 1px solid #e8edf3;
  color: #8b95a5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
}

.item-row {
  min-height: 64px;
  padding: 8px 16px;
  border-bottom: 1px solid #eef1f5;
  transition: background .14s;
}

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

.item-row:hover {
  background: var(--sky-50);
}

.folder-row {
  cursor: pointer;
  user-select: none;
}

.folder-row:hover {
  background: #f0f7fc;
}

.folder-row:active, .file-row:active {
  background: #e2f0fb;
}

.file-row .name-cell {
  cursor: pointer;
}

.file-row .name-cell:hover strong {
  color: var(--sky-600);
  text-decoration: underline;
}

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

.name-cell div {
  min-width: 0;
}

.name-cell strong, .name-cell small {
  display: block;
}

.name-cell strong {
  color: #1d2939;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-cell small {
  color: #98a2b3;
  font-size: 10px;
  margin-top: 2px;
}

.item-icon {
  width: 39px;
  height: 39px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .03em;
  background: #f2f4f7;
  color: #64748b;
}

.item-icon.folder {
  font-size: 20px;
  background: #fff5dc;
  color: #d49a1d;
}

.item-icon.image {
  background: #edf8f2;
  color: #2c9d6a;
}

.item-icon.document {
  background: #eef4ff;
  color: #4775dd;
}

.item-icon.video {
  background: #fff0f2;
  color: #da556a;
}

.item-icon.audio {
  background: #fff6e8;
  color: #d48a27;
}

.item-icon.archive {
  background: var(--sky-100);
  color: var(--sky-700);
}

.meta {
  font-size: 12px;
  color: #667085;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.row-action {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #7b8494;
}

.row-action:hover {
  background: #edf1f6;
  color: #344054;
}

.row-action.danger:hover {
  background: #fff0f0;
  color: #d92d20;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 14px 16px;
  border-top: 1px solid #eef1f5;
}

.load-more-row:has(button[hidden]) {
  display: none;
}

.empty-state {
  text-align: center;
  padding: 58px 20px;
  color: #8791a2;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  font-size: 38px;
  color: #aeb7c5;
}

.empty-state strong {
  display: block;
  color: #344054;
  margin-top: 7px;
}

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

.upload-queue {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 13px;
  padding: 8px;
}

.queue-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 1.2fr) 100px 34px;
  gap: 12px;
  align-items: center;
  padding: 8px;
}

.queue-row.error {
  background: #fff8f7;
}

.queue-name {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-progress {
  height: 6px;
  border-radius: 99px;
  background: #edf0f5;
  overflow: hidden;
}

.queue-progress i {
  display: block;
  height: 100%;
  background: var(--sky-500);
  border-radius: 99px;
}

.queue-state {
  font-size: 11px;
  color: #687386;
  text-align: right;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #0f172a88;
  backdrop-filter: blur(3px);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(520px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 24px 80px #0f172a45;
}

.modal-small {
  width: min(430px, 100%);
}

.modal-kicker {
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--sky-600);
  font-weight: 800;
}

.modal h2 {
  margin: 5px 0 8px;
  font-size: 23px;
  color: #101828;
}

.modal p {
  margin: 0 0 18px;
  color: #667085;
  font-size: 13px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 0;
  background: #f3f5f8;
  color: #64748b;
  cursor: pointer;
  font-size: 19px;
}

.modal form {
  display: grid;
  gap: 14px;
}

.modal label {
  font-size: 12px;
  color: #475467;
  font-weight: 700;
}

.modal input, .modal select {
  display: block;
  width: 100%;
  margin-top: 6px;
  height: 43px;
  border: 1px solid #d4dce7;
  border-radius: 10px;
  padding: 0 12px;
  outline: 0;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.modal input:focus, .modal select:focus {
  border-color: var(--sky-400);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.form-submit {
  width: 100%;
  margin-top: 2px;
}

.form-error {
  padding: 9px 11px;
  border-radius: 9px;
  background: #fff1f0;
  color: #b42318;
  font-size: 11px;
}

.form-error[hidden] {
  display: none;
}

.security-note {
  display: block;
  margin-top: 13px;
  color: #98a2b3;
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 44px));
  background: #111827;
  color: #fff;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 12px;
  box-shadow: 0 15px 35px #0f172a35;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .list-head, .item-row {
    grid-template-columns: minmax(250px, 2fr) 90px 90px minmax(150px, 1fr);
  }
  .list-head span:nth-child(2), .item-row > span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 800px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
  }
  .folder-tree, .sidebar-spacer, .side-section-title, .folder-title-row {
    display: none;
  }
  .main {
    width: 100%;
  }
  .topbar {
    padding: 0 16px;
  }
  .content {
    padding: 22px 14px 40px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions button {
    flex: 1;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .explorer-toolbar {
    flex-wrap: wrap;
  }
  .search-box {
    min-width: 100%;
  }
  .explorer-toolbar select {
    flex: 1;
  }
  .list-head {
    display: none;
  }
  .item-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
  }
  .item-row > .meta {
    display: none;
  }
  .row-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .page-actions {
    flex-direction: column;
  }
  .explorer-toolbar select {
    width: 100%;
    flex: auto;
  }
  .queue-row {
    grid-template-columns: minmax(0, 1fr) 80px;
  }
  .queue-progress {
    display: none;
  }
}

/* Upload area */
.upload-panel {
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--sky-100);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

.upload-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px 15px;
}

.upload-kicker {
  display: block;
  color: var(--sky-600);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
}

.upload-panel-heading h2 {
  margin: 3px 0 0;
  color: #172033;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.upload-destination {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 45%;
  padding: 7px 11px;
  border: 1px solid var(--sky-200);
  border-radius: 999px;
  background: var(--sky-50);
  color: var(--sky-700);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.upload-destination svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.upload-destination span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-panel .dropzone {
  position: relative;
  min-height: 148px;
  margin: 0 18px;
  padding: 24px 28px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 22px;
  cursor: pointer;
  border: 2px dashed var(--sky-300);
  border-radius: 14px;
  background: linear-gradient(105deg, var(--sky-50) 0%, var(--sky-100) 64%, #f0f7ff 100%);
  transition: background .2s, border-color .2s, box-shadow .2s;
}

.upload-panel .dropzone::before {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  right: -65px;
  top: -115px;
  border: 1px solid var(--sky-200);
  border-radius: 50%;
  pointer-events: none;
}

.upload-panel .dropzone::after {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  right: -25px;
  top: -74px;
  border: 1px solid var(--sky-200);
  border-radius: 50%;
  pointer-events: none;
}

.upload-panel .dropzone:hover,
.upload-panel .dropzone.dragover {
  border-color: var(--sky-600);
  background: linear-gradient(105deg, var(--sky-50) 0%, var(--sky-100) 100%);
  box-shadow: inset 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.upload-panel .dropzone:focus-visible {
  outline: 3px solid var(--sky-600);
  outline-offset: 3px;
}

.upload-panel .drop-icon {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--sky-200);
  border-radius: 20px;
  background: #fff;
  color: var(--sky-600);
  box-shadow: 0 12px 25px rgba(14, 165, 233, 0.18), 0 3px 7px rgba(14, 165, 233, 0.12);
}

.drop-icon svg {
  width: 42px;
  height: 42px;
}

.drop-copy {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.upload-panel .drop-copy strong {
  display: block;
  color: var(--sky-900);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.025em;
}

.upload-panel .drop-copy small {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
}

.drop-cta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: none;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 11px;
  background: var(--sky-600);
  color: #fff;
  box-shadow: 0 8px 20px var(--sky-glow);
  font-size: 12px;
  font-weight: 750;
  transition: background .2s, transform .2s;
}

.drop-cta span {
  font-size: 18px;
  line-height: 1;
}

.dropzone:hover .drop-cta,
.dropzone.dragover .drop-cta {
  background: var(--sky-700);
  transform: translateY(-1px);
}

.upload-note {
  margin: 0;
  padding: 11px 20px 14px;
  color: #858ba1;
  font-size: 11px;
}

.upload-note::before {
  content: '●';
  margin-right: 8px;
  color: var(--sky-500);
  font-size: 7px;
  vertical-align: 1px;
}

.upload-panel .upload-queue {
  margin: 0 18px 18px;
}

@media (max-width: 720px) {
  .upload-panel-heading {
    align-items: flex-start;
  }
  .upload-panel .dropzone {
    gap: 15px;
    padding: 20px;
  }
  .upload-panel .drop-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }
  .drop-icon svg {
    width: 35px;
    height: 35px;
  }
  .upload-panel .drop-copy strong {
    font-size: 15px;
  }
  .drop-cta {
    min-height: 40px;
    padding: 0 13px;
  }
}

@media (max-width: 560px) {
  .upload-panel-heading {
    display: block;
  }
  .upload-destination {
    max-width: 100%;
    margin-top: 12px;
  }
  .upload-panel .dropzone {
    flex-direction: column;
    text-align: center;
    gap: 13px;
    padding: 25px 18px;
  }
  .drop-copy {
    flex: none;
  }
  .upload-panel .drop-copy small {
    line-height: 1.5;
  }
  .drop-cta {
    width: 100%;
    max-width: 200px;
    margin-top: 2px;
  }
  .upload-note {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .upload-panel .dropzone, .drop-cta {
    transition: none;
  }
}
