:root {
  color-scheme: light;
  --bg: #f8fafd;
  --surface: #ffffff;
  --surface-soft: #f1f4f9;
  --text: #1f1f1f;
  --muted: #5f6368;
  --subtle: #80868b;
  --line: #dfe3eb;
  --line-strong: #c9d1de;
  --blue: #1a73e8;
  --blue-soft: #e8f0fe;
  --folder: #fbbc04;
  --green: #188038;
  --danger: #d93025;
  --shadow: 0 1px 2px rgba(60, 64, 67, .18), 0 1px 3px rgba(60, 64, 67, .12);
  --shadow-pop: 0 8px 26px rgba(60, 64, 67, .2);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

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

button {
  border: 0;
}

a {
  color: inherit;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .14);
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

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

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  padding: 30px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  letter-spacing: -.04em;
}

.auth-card h1 {
  margin: 18px 0 6px;
  font-size: clamp(2rem, 4vw, 2.7rem);
  letter-spacing: -.04em;
}

.auth-card p {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.stack button,
.new-button,
.modal-actions button,
.mobile-tree-button {
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.stack button:hover,
.new-button:hover,
.modal-actions button:hover,
.mobile-tree-button:hover {
  filter: brightness(.96);
}

.page-wrap {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.drive-app {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
}

.drive-sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 18px 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid transparent;
}

.drive-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
}

.drive-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  font-size: .85rem;
}

.drive-name {
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -.02em;
}

.drive-user {
  max-width: 190px;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.new-menu-wrap {
  position: relative;
  margin: 24px 0 18px;
  padding: 0 8px;
}

.new-button {
  min-width: 120px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  color: #202124;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
}

.new-button:hover {
  background: #f8fbff;
  box-shadow: 0 2px 6px rgba(60, 64, 67, .22);
}

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

.new-menu {
  position: absolute;
  z-index: 30;
  left: 8px;
  top: calc(100% + 8px);
  min-width: 214px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 8px 0;
  box-shadow: var(--shadow-pop);
}

.new-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  color: var(--text);
  padding: 11px 16px;
  text-align: left;
  cursor: pointer;
}

.new-menu button:hover {
  background: var(--surface-soft);
}

.new-menu i {
  width: 18px;
  color: var(--blue);
}

.sidebar-section-title {
  padding: 0 18px 8px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.folder-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.tree-node {
  display: grid;
  gap: 1px;
}

.tree-item {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 0 18px 18px 0;
  background: transparent;
  color: #3c4043;
  padding: 8px 10px 8px calc(18px + var(--indent, 0px));
  cursor: pointer;
  text-align: left;
}

.tree-item:hover {
  background: #edf2fa;
}

.tree-item.active {
  background: var(--blue-soft);
  color: #174ea6;
  font-weight: 700;
}

.tree-item i {
  width: 18px;
  color: var(--folder);
}

.tree-item .fa-google-drive {
  color: var(--blue);
}

.tree-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-panel {
  margin: 14px 8px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.upload-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .88rem;
  font-weight: 700;
}

.upload-file-name,
.upload-status {
  margin-top: 6px;
  color: var(--muted);
  font-size: .78rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-track {
  height: 6px;
  margin-top: 10px;
  border-radius: 999px;
  background: #e8eaed;
  overflow: hidden;
}

.upload-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width .18s ease;
}

.sidebar-logout {
  margin: 14px 10px 0;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
}

.sidebar-logout:hover {
  color: var(--blue);
}

.drive-main {
  min-width: 0;
  min-height: 100vh;
  padding: 18px 20px 20px 6px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.drive-topbar {
  min-height: 84px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 0 8px;
}

.eyebrow {
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.drive-topbar h1 {
  margin: 7px 0 5px;
  font-size: 1.95rem;
  font-weight: 500;
  letter-spacing: -.03em;
}

.breadcrumb {
  color: var(--muted);
  font-size: .92rem;
}

.mobile-tree-button {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.content-grid-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.drive-app.preview-open .content-grid-shell {
  grid-template-columns: minmax(0, 1fr) 390px;
}

.items-zone {
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.items-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 12px;
}

.items-toolbar h2 {
  margin: 0 0 3px;
  font-size: 1rem;
  font-weight: 600;
}

.items-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}

.items-grid {
  min-height: 0;
  overflow: auto;
  padding-bottom: 10px;
}

.files-list {
  min-width: 760px;
}

.drive-app.preview-open .files-list {
  min-width: 0;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 130px 180px 110px 96px;
  align-items: center;
  min-height: 50px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}

.drive-app.preview-open .file-row {
  grid-template-columns: minmax(190px, 1fr) 58px 132px 72px 42px;
  font-size: .84rem;
}

.drive-app.preview-open .file-row > div,
.drive-app.preview-open .file-row .file-name-cell {
  padding-inline: 12px;
}

.file-row.list-header {
  min-height: 42px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 4;
}

.file-row > div,
.file-row .file-name-cell {
  min-width: 0;
  padding: 0 18px;
}

.file-row:not(.list-header):hover,
.file-row.selected {
  background: #f5f8ff;
}

.file-row.selected {
  outline: 1px solid #c9ddff;
  outline-offset: -1px;
}

.file-name-cell {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  background: transparent;
  color: #202124;
  cursor: pointer;
  text-align: left;
}

.file-icon {
  width: 28px;
  display: inline-flex;
  justify-content: center;
  color: #5f6368;
  font-size: 1.08rem;
  flex: 0 0 auto;
}

.file-icon.folder {
  color: var(--folder);
}

.file-icon.image {
  color: var(--green);
}

.file-icon.video {
  color: #a142f4;
}

.file-icon.audio {
  color: #d93025;
}

.file-icon.text {
  color: var(--blue);
}

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

.file-owner,
.file-modified,
.file-size {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-right: 12px !important;
}

.icon-link {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: #5f6368;
  text-decoration: none;
  cursor: pointer;
}

.icon-link:hover {
  background: #edf2fa;
  color: var(--blue);
}

.danger-link:hover {
  color: var(--danger);
}

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

.empty-list h3,
.empty-list p {
  margin: 0;
}

.empty-list-icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 1.4rem;
}

.preview-pane {
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: auto;
  padding: 18px;
}

.preview-pane[hidden] {
  display: none;
}

.preview-loading,
.unknown-preview {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.preview-head {
  position: relative;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.preview-close {
  position: absolute;
  right: 0;
  top: 0;
}

.preview-file-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 1.75rem;
}

.preview-file-icon.large {
  margin: 0 auto 10px;
}

.preview-head h2 {
  margin: 0;
  max-width: 100%;
  font-size: 1.1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.preview-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.preview-download:hover {
  background: var(--blue-soft);
}

.preview-meta {
  display: grid;
  gap: 0;
  margin: 10px 0 16px;
}

.preview-meta div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.preview-meta span {
  color: var(--muted);
}

.preview-meta strong {
  min-width: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.text-preview {
  max-height: calc(100vh - 360px);
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafd;
  color: #202124;
  padding: 14px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: .84rem;
}

.media-frame {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafd;
  overflow: hidden;
}

.media-frame img,
.media-frame video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 360px);
  object-fit: contain;
}

.audio-frame {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafd;
  padding: 16px;
}

.audio-frame audio {
  width: 100%;
}

.alert {
  border-radius: 10px;
  padding: 11px 14px;
  border: 1px solid;
}

.alert.error {
  border-color: #f4b7b2;
  background: #fce8e6;
  color: var(--danger);
}

.alert.success {
  border-color: #b7dfc3;
  background: #e6f4ea;
  color: var(--green);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(32, 33, 36, .36);
}

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

.modal-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 600;
}

.modal-copy {
  color: var(--muted);
  line-height: 1.55;
}

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

.secondary-button {
  background: transparent !important;
  color: var(--blue) !important;
  border: 1px solid transparent !important;
}

.secondary-button:hover {
  background: var(--blue-soft) !important;
}

.danger-button {
  background: var(--danger) !important;
  color: #fff !important;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #202124;
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
  color: #fff;
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 980px) {
  .drive-app {
    grid-template-columns: 1fr;
  }

  .drive-sidebar {
    position: fixed;
    z-index: 70;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    height: auto;
    box-shadow: var(--shadow-pop);
    transform: translateX(-105%);
    transition: transform .18s ease;
  }

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

  .drive-main {
    padding: 14px;
  }

  .mobile-tree-button {
    display: inline-flex;
  }

  .drive-app.preview-open .content-grid-shell {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    min-height: 320px;
  }
}

@media (max-width: 720px) {
  .drive-topbar {
    flex-direction: column;
  }

  .mobile-tree-button {
    width: 100%;
    justify-content: center;
  }

  .file-row {
    grid-template-columns: minmax(220px, 1fr) 92px 84px;
  }

  .file-owner,
  .file-modified,
  .file-row.list-header > div:nth-child(2),
  .file-row.list-header > div:nth-child(3) {
    display: none;
  }

  .files-list {
    min-width: 0;
  }
}
