:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #eef6f4;
  --text: #171a1f;
  --muted: #68707d;
  --line: #dde3ea;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --coral: #e85d3f;
  --green: #2f855a;
  --violet: #6d5bd0;
  --danger: #c2410c;
  --shadow: 0 18px 45px rgba(28, 38, 55, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden,
[hidden] {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
  transition:
    transform 180ms ease,
    color 180ms ease;
}

button:hover .icon,
.profile-button:hover .avatar,
.stat-card:hover .stat-icon {
  transform: translateY(-3px);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(320px, 1fr);
  gap: 64px;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.auth-panel {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-row,
.sidebar-brand,
.topbar-actions,
.section-head,
.modal-header,
.profile-editor,
.preview-footer {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 16px;
  margin-bottom: 28px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--teal);
  color: #ffffff;
}

.brand-logo.small {
  width: 40px;
  height: 40px;
}

.brand-logo .icon {
  width: 28px;
  height: 28px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 16px;
  font-size: 1rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #eef1f5;
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 5px 16px rgba(28, 38, 55, 0.08);
}

.auth-form,
.settings-layout {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.field input,
.field select,
.searchbar input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field input,
.field select {
  height: 46px;
  padding: 0 14px;
}

.field input:focus,
.field select:focus,
.searchbar input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.form-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.icon-button,
.nav-button,
.profile-button {
  border: 0;
  border-radius: var(--radius);
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  font-weight: 850;
  white-space: nowrap;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.18);
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.primary-button.wide {
  width: 100%;
}

.secondary-button {
  background: #eef1f5;
  color: var(--text);
}

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

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

.auth-showcase {
  min-height: 540px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 22%, rgba(15, 118, 110, 0.18), transparent 30%),
    radial-gradient(circle at 75% 68%, rgba(232, 93, 63, 0.14), transparent 26%),
    linear-gradient(135deg, #ffffff 0%, #edf6f3 100%);
  border: 1px solid var(--line);
}

.showcase-logo {
  position: absolute;
  left: 48px;
  top: 48px;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--teal);
  box-shadow: var(--shadow);
}

.showcase-logo .icon {
  width: 44px;
  height: 44px;
}

.showcase-stack {
  position: absolute;
  right: 60px;
  bottom: 56px;
  display: grid;
  gap: 18px;
}

.mini-file {
  width: clamp(160px, 20vw, 250px);
  height: 108px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.mini-file .icon {
  width: 34px;
  height: 34px;
}

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

.video-file {
  color: var(--violet);
  transform: translateX(-56px);
}

.document-file {
  color: var(--coral);
  transform: translateX(24px);
}

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

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.sidebar-brand {
  gap: 12px;
  font-weight: 900;
  font-size: 1.05rem;
}

.nav-list,
.sidebar-footer {
  display: grid;
  gap: 8px;
}

.sidebar-footer {
  margin-top: auto;
}

.nav-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.nav-button:hover,
.nav-button.active {
  background: var(--surface-soft);
  color: var(--teal);
}

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

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.searchbar {
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
}

.searchbar input {
  height: 100%;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.topbar-actions {
  gap: 12px;
}

.profile-button {
  min-width: 0;
  height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-weight: 850;
}

.profile-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.96), rgba(232, 93, 63, 0.84)),
    var(--teal);
  color: #ffffff;
  font-weight: 900;
  background-size: cover;
  background-position: center;
  transition: transform 180ms ease;
  flex: 0 0 auto;
}

.avatar.large {
  width: 82px;
  height: 82px;
  font-size: 1.35rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  min-height: 96px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.stat-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.stat-card strong {
  font-size: 1.38rem;
}

.stat-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  transition: transform 180ms ease;
}

.stat-icon.teal {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal);
}

.stat-icon.coral {
  background: rgba(232, 93, 63, 0.12);
  color: var(--coral);
}

.stat-icon.green {
  background: rgba(47, 133, 90, 0.12);
  color: var(--green);
}

.stat-icon.violet {
  background: rgba(109, 91, 208, 0.12);
  color: var(--violet);
}

.files-section {
  min-height: 440px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.toolbar {
  display: inline-grid;
  grid-template-columns: repeat(2, 40px);
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius);
  background: #eef1f5;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover,
.icon-button.active {
  background: #ffffff;
  color: var(--teal);
}

.file-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.file-list.list-view {
  display: grid;
  gap: 10px;
}

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

.file-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 12px 26px rgba(28, 38, 55, 0.1);
}

.file-preview {
  height: 150px;
  display: grid;
  place-items: center;
  background: #f2f4f7;
  color: var(--muted);
  overflow: hidden;
}

.file-preview img,
.file-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-preview.generic .icon {
  width: 42px;
  height: 42px;
}

.file-info {
  min-width: 0;
  padding: 14px;
}

.file-name {
  margin: 0 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.file-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.file-actions {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  justify-content: end;
  gap: 4px;
  padding: 0 10px 10px;
}

.file-list.list-view .file-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
}

.file-list.list-view .file-preview {
  width: 72px;
  height: 72px;
}

.file-list.list-view .file-actions {
  padding: 0 10px;
}

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

.empty-state h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
}

.empty-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--teal);
}

.empty-icon .icon {
  width: 34px;
  height: 34px;
}

.modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.modal::backdrop {
  background: rgba(23, 26, 31, 0.42);
  backdrop-filter: blur(5px);
}

.modal-shell {
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.modal-header {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.settings-group {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.profile-editor {
  gap: 16px;
}

.profile-editor-actions {
  min-width: 0;
}

.danger-zone {
  align-items: start;
}

.preview-shell {
  width: min(900px, calc(100vw - 32px));
}

.preview-body {
  min-height: 260px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #f2f4f7;
  overflow: hidden;
}

.preview-body img,
.preview-body video {
  max-width: 100%;
  max-height: 68vh;
  display: block;
}

.preview-body video {
  width: 100%;
}

.preview-body .generic-preview {
  display: grid;
  gap: 12px;
  place-items: center;
  color: var(--muted);
  font-weight: 850;
}

.preview-body .generic-preview .icon {
  width: 58px;
  height: 58px;
}

.preview-footer {
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 760;
}

.dragging {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: -8px;
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
    padding: 32px 18px;
  }

  .auth-showcase {
    display: none;
  }

  .drive-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .searchbar {
    grid-column: 1 / -1;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .auth-panel {
    padding: 24px;
  }

  .summary-grid,
  .nav-list,
  .sidebar-footer,
  .topbar {
    grid-template-columns: 1fr;
  }

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

  .profile-button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .section-head,
  .preview-footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .file-list.list-view .file-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .file-list.list-view .file-actions {
    grid-column: 1 / -1;
    justify-content: start;
    padding: 0 10px 10px;
  }
}
