:root {
  --blue: #1a73e8;
  --blue-dark: #1765cc;
  --blue-soft: #e8f0fe;
  --text: #1f1f1f;
  --muted: #5f6368;
  --muted-2: #80868b;
  --line: #dadce0;
  --bg: #f8fafd;
  --surface: #ffffff;
  --hover: #f1f3f4;
  --danger: #d93025;
  --danger-soft: #fce8e6;
  --green: #188038;
  --shadow-1: 0 1px 2px rgba(60,64,67,.15), 0 1px 3px 1px rgba(60,64,67,.08);
  --shadow-2: 0 2px 6px rgba(60,64,67,.15), 0 8px 24px rgba(60,64,67,.15);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex: 0 0 auto;
  fill: currentColor;
}

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--surface);
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Brand */
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.brand-logo .icon { width: 28px; height: 28px; }
.brand-logo.lg { width: 64px; height: 64px; border-radius: 18px; }
.brand-logo.lg .icon { width: 38px; height: 38px; }
.brand-logo.sm { width: 38px; height: 38px; border-radius: 10px; }
.brand-logo.sm .icon { width: 23px; height: 23px; }

/* Login */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 0%, #e8f0fe 0%, rgba(232,240,254,0) 60%),
    radial-gradient(900px 600px at 90% 100%, #f1f3f4 0%, rgba(241,243,244,0) 55%),
    var(--surface);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 34px 28px;
  box-shadow: var(--shadow-1);
  animation: rise .35s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.login-card h1 { font-size: 26px; font-weight: 500; margin: 20px 0 6px; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-foot { margin: 22px 0 0; color: var(--muted-2); font-size: 12px; text-align: center; line-height: 1.5; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; letter-spacing: .2px; }
.field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 14px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,.14); }
.form-error {
  background: var(--danger-soft);
  color: #b3261e;
  font-size: 13px;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, box-shadow .15s, border-color .15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); box-shadow: var(--shadow-1); }
.btn-primary:disabled { opacity: .6; cursor: default; box-shadow: none; }
.btn.ghost { border-color: var(--line); background: #fff; }
.btn.ghost:hover { background: var(--hover); }
.btn.ghost .icon { color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b3261e; }
.btn-block { width: 100%; height: 46px; margin-top: 4px; }

/* App shell */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 12px;
  border-bottom: 1px solid transparent;
  background: var(--surface);
  position: relative;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  padding: 4px 6px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.brand:hover { background: var(--hover); }
.brand-name { font-size: 21px; font-weight: 500; letter-spacing: -.2px; color: #3c4043; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  max-width: 720px;
  height: 48px;
  margin: 0 auto;
  padding: 0 14px;
  border-radius: 999px;
  background: #f1f3f4;
  transition: background .15s, box-shadow .15s;
}
.search-wrap:focus-within { background: #fff; box-shadow: var(--shadow-1); }
.search-wrap .search-icon { color: var(--muted); width: 22px; height: 22px; }
.search-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #e8f0fe;
  color: var(--blue);
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar.big { width: 44px; height: 44px; font-size: 18px; flex: 0 0 auto; }
.avatar:hover { box-shadow: var(--shadow-1); }

.layout { flex: 1 1 auto; display: flex; min-height: 0; }
.sidebar {
  width: 256px;
  flex: 0 0 256px;
  padding: 10px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  background: var(--bg);
}
.new-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  height: 52px;
  padding: 0 20px 0 12px;
  margin: 6px 0 10px 4px;
  border: 1px solid #e0e3e7;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-1);
  font-size: 14px;
  font-weight: 600;
  color: #3c4043;
  transition: box-shadow .15s, background .15s;
}
.new-btn:hover { box-shadow: var(--shadow-2); background: #fff; }
.new-plus {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.new-plus .icon { width: 22px; height: 22px; }
.new-btn .chev { width: 16px; height: 16px; color: var(--muted); transform: rotate(90deg); margin-left: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #3c4043;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
.nav-item .icon { color: #5f6368; }
.nav-item:hover { background: #eef1f4; }
.nav-item.active { background: #d3e3fd; color: #0b57d0; }
.nav-item.active .icon { color: #0b57d0; }
.sidebar-spacer { flex: 1 1 auto; min-height: 20px; }
.storage-box { padding: 8px 16px 14px; }
.storage-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #3c4043; margin-bottom: 9px; }
.storage-title .icon { width: 18px; height: 18px; color: var(--muted); }
.storage-bar { height: 4px; border-radius: 999px; background: #e0e3e7; overflow: hidden; }
.storage-bar span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width .4s; }
.storage-text { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.logout { margin-top: 4px; color: var(--muted); }
.scrim { display: none; }

/* Main */
.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 24px 40px;
  overflow-y: auto;
  background: var(--surface);
}
.main-head {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; flex: 1 1 auto; }
.crumb {
  border: 0;
  background: none;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 500;
  color: #3c4043;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb:hover { background: var(--hover); }
.crumb.current { cursor: default; }
.crumb.current:hover { background: none; }
.crumb-sep { color: var(--muted-2); font-size: 20px; display: inline-flex; align-items: center; }
.crumb-sep .icon { width: 18px; height: 18px; }
.result-title { display: flex; flex-direction: column; gap: 2px; padding-left: 8px; }
.result-title h1 { font-size: 22px; font-weight: 500; margin: 0; color: #3c4043; }
.result-title p { margin: 0; font-size: 12.5px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sort-select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #3c4043;
  font-size: 13px;
  padding: 0 10px;
  outline: none;
}
.sort-select:focus { border-color: var(--blue); }
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { background: var(--blue-soft); color: var(--blue); }
.view-toggle .icon-btn { border-radius: 0; width: 38px; height: 34px; }
.icon-btn.tiny { width: 28px; height: 28px; }
.icon-btn.tiny .icon { width: 16px; height: 16px; }

/* List header */
.list-header {
  display: grid;
  grid-template-columns: minmax(0,1fr) 150px 100px 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
}
.lh-name { padding-left: 34px; }

/* File grid */
.file-area { padding-top: 16px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  transition: box-shadow .15s, border-color .15s, transform .15s;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card:hover, .card:focus-visible { box-shadow: var(--shadow-1); border-color: #dadce0; }
.card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(26,115,232,.18); }
.card .thumb {
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafd;
  overflow: hidden;
}
.card .thumb .icon { width: 46px; height: 46px; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #f0f1f2;
  min-width: 0;
}
.card .card-text { min-width: 0; flex: 1 1 auto; }
.card-name {
  font-size: 13px;
  font-weight: 600;
  color: #3c4043;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-more {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  flex: 0 0 auto;
}
.card:hover .card-more, .card:focus-within .card-more, .card.selected .card-more { opacity: 1; }
.card-more:hover { background: var(--hover); color: var(--text); }
.card-more .icon { width: 20px; height: 20px; }

/* File list */
.list { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 150px 100px 40px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid #f0f1f2;
  cursor: pointer;
  animation: fade .18s ease-out;
}
.row:hover { background: #f8fafd; }
.row.selected { background: var(--blue-soft); }
.row-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-ico {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #f1f3f4;
}
.row-ico.type-folder { background: #e8f0fe; }
.row-ico .icon { width: 18px; height: 18px; }
.row-title { min-width: 0; }
.row-title .name { display: block; font-size: 13.5px; font-weight: 500; color: #3c4043; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-date, .row-size { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-more {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.row:hover .row-more, .row.selected .row-more, .row:focus-within .row-more { opacity: 1; }
.row-more:hover { background: #e8eaed; color: var(--text); }
.row-more .icon { width: 20px; height: 20px; }

/* Type colors */
.type-image { color: #188038; }
.type-video { color: #d93025; }
.type-audio { color: #a142f4; }
.type-pdf { color: #d93025; }
.type-doc { color: #1967d2; }
.type-sheet { color: #188038; }
.type-slide { color: #f9ab00; }
.type-archive { color: #b06000; }
.type-code { color: #00796b; }
.type-text { color: #5f6368; }
.type-file { color: #5f6368; }
.type-folder { color: #5f6368; }

/* Empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty-icon {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.empty-icon .icon { width: 46px; height: 46px; color: #aeb4ba; }
.empty h2 { font-size: 18px; font-weight: 500; color: #3c4043; margin: 0 0 6px; }
.empty p { margin: 0 0 20px; font-size: 13.5px; max-width: 340px; line-height: 1.5; }

/* Menus */
.menu {
  position: fixed;
  z-index: 60;
  min-width: 230px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  border: 1px solid #f0f1f2;
  animation: menuIn .12s ease-out;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #3c4043;
  font-size: 13.5px;
  text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item .icon { width: 19px; height: 19px; color: var(--muted); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: #e8eaed; margin: 5px 6px; }
.account-menu {
  position: fixed;
  z-index: 70;
  top: 58px;
  right: 14px;
  width: 300px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  border: 1px solid #f0f1f2;
  padding: 10px;
  animation: menuIn .15s ease-out;
}
.account-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 16px; border-bottom: 1px solid #e8eaed; margin-bottom: 6px; }
.account-name { font-size: 15px; font-weight: 600; color: #3c4043; }
.account-mail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Modals */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(32,33,36,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade .15s;
}
.modal {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: pop .18s ease-out;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 19px; font-weight: 500; margin: 0; color: #3c4043; }
.modal-body { padding: 14px 20px 20px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.delete-text { font-size: 15px; margin: 4px 0 8px; color: #3c4043; }
.delete-text b { word-break: break-word; }

/* Preview */
.modal.preview { max-width: 1040px; height: min(88vh, 860px); background: #202124; border-radius: 14px; }
.preview-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 10px 18px;
  background: #202124;
  color: #e8eaed;
  border-bottom: 1px solid #3c4043;
}
.preview-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#previewName { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-meta { font-size: 11.5px; color: #9aa0a6; }
.preview-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.preview-actions .btn.ghost { color: #e8eaed; border-color: #5f6368; background: transparent; height: 34px; }
.preview-actions .btn.ghost:hover { background: rgba(255,255,255,.08); }
.preview-actions .btn.ghost .icon { color: #e8eaed; }
.preview-actions .icon-btn { color: #e8eaed; }
.preview-actions .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.preview-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #202124;
}
.preview-body img { max-width: 100%; max-height: 100%; display: block; }
.preview-body video { max-width: 100%; max-height: 100%; background: #000; }
.preview-body audio { width: min(560px, 90%); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body pre {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 22px;
  color: #e8eaed;
  font: 13px/1.55 Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.preview-fallback { text-align: center; color: #e8eaed; padding: 30px; }
.preview-fallback .big-icon { width: 84px; height: 84px; color: #9aa0a6; margin-bottom: 14px; }
.preview-fallback h3 { font-weight: 500; font-size: 17px; margin: 0 0 6px; }
.preview-fallback p { color: #9aa0a6; font-size: 13px; margin: 0 0 18px; }


/* Document / sheet / editor previews */
.preview-body.doc-host-wrap {
  display: block;
  overflow: auto;
  background: #f1f3f4;
}
.preview-body.edit-mode {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  background: #fff;
}
.preview-loading { padding: 34px; color: #9aa0a6; font-size: 13.5px; }
.docx-host { width: 100%; padding: 18px 10px 34px; }
.docx-host .docx-wrapper {
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.docx-host .docx-wrapper > section.docx {
  margin: 0 auto;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.sheet-host {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}
.sheet-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  overflow-x: auto;
}
.sheet-tab {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font-size: 12.5px;
  color: #5f6368;
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
}
.sheet-tab:hover { background: #eef1f4; }
.sheet-tab.active { background: #fff; color: #1a73e8; font-weight: 600; }
.sheet-table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; position: relative; }
.sheet-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  color: #202124;
  min-width: 100%;
}
.sheet-table th, .sheet-table td {
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  padding: 4px 8px;
  min-width: 84px;
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  vertical-align: top;
  line-height: 1.45;
}
.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8f9fa;
  font-weight: 600;
  color: #5f6368;
  text-align: center;
}
.sheet-table th.row-head {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 46px;
  width: 46px;
  background: #f8f9fa;
  color: #5f6368;
  font-weight: 600;
  text-align: center;
}
.sheet-table thead th.row-head { z-index: 3; }
.sheet-table td.num { text-align: right; }
.sheet-table td[contenteditable="true"] { outline: none; cursor: cell; }
.sheet-table td[contenteditable="true"]:focus { box-shadow: inset 0 0 0 2px #1a73e8; background: #fff !important; }
.sheet-table tbody tr:nth-child(even) td { background: #fcfcfd; }
.sheet-truncated {
  position: sticky;
  left: 0;
  padding: 8px 12px;
  font-size: 11.5px;
  color: #80868b;
  background: #fff;
}

.editor-note {
  flex: 0 0 auto;
  background: #fef7e0;
  color: #7a5c00;
  font-size: 12px;
  line-height: 1.45;
  padding: 9px 14px;
  border-bottom: 1px solid #f0e0a8;
}
.editor-note.dark {
  background: #2a2b2e;
  color: #bdc1c6;
  border-bottom: 1px solid #3c4043;
}

.text-editor-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #202124;
}
.text-editor {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  resize: none;
  padding: 18px 20px;
  background: #202124;
  color: #e8eaed;
  font: 13px/1.6 Consolas, "Cascadia Mono", monospace;
  outline: none;
  white-space: pre;
  tab-size: 4;
}
.text-editor:disabled { opacity: .6; }

.docx-editor-wrap {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #f1f3f4;
  padding: 18px;
}
.docx-editor {
  max-width: 820px;
  min-height: 72vh;
  margin: 0 auto;
  background: #fff;
  padding: 56px 64px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  outline: none;
  font: 15px/1.65 Calibri, Arial, sans-serif;
  color: #202124;
}
.docx-editor:focus { box-shadow: 0 0 0 2px #1a73e8, 0 1px 4px rgba(0,0,0,.2); }
.docx-editor.loading { color: #9aa0a6; font-style: italic; cursor: default; }
.docx-editor h1 { font-size: 26px; margin: .5em 0 .35em; }
.docx-editor h2 { font-size: 22px; margin: .6em 0 .3em; }
.docx-editor h3 { font-size: 19px; margin: .6em 0 .3em; }
.docx-editor h4, .docx-editor h5, .docx-editor h6 { font-size: 16px; margin: .6em 0 .3em; }
.docx-editor p { margin: 0 0 .7em; }
.docx-editor ul, .docx-editor ol { margin: 0 0 .8em; padding-left: 1.5em; }
.docx-editor table { border-collapse: collapse; width: 100%; margin: 0 0 .8em; }
.docx-editor th, .docx-editor td { border: 1px solid #c7c7c7; padding: 5px 8px; text-align: left; }
.docx-editor th { background: #f0f0f0; }
.docx-editor img { max-width: 100%; }
.docx-editor pre { background: #f4f4f5; padding: 10px; font-size: 12.5px; overflow: auto; }

.pdf-editor {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #f1f3f4;
}
.pdf-pages {
  max-width: 760px;
  margin: 16px auto 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px;
}
.pdf-page-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 10px 12px 10px 16px;
}
.pdf-page-num { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pdf-page-num b { font-size: 13.5px; font-weight: 600; color: #202124; }
.pdf-page-num span { font-size: 11.5px; color: #80868b; }
.pdf-page-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.pdf-page-actions .icon-btn { width: 34px; height: 34px; color: #5f6368; }
.pdf-page-actions .icon-btn:hover { background: #f1f3f4; color: #202124; }
.pdf-page-actions .icon-btn:disabled { opacity: .3; }
.pdf-page-actions .icon-btn.danger { color: #d93025; }
.preview-actions .btn:disabled { opacity: .45; }

@media (max-width: 620px) {
  .docx-host { padding: 8px 0 20px; }
  .docx-editor-wrap { padding: 8px; }
  .docx-editor { padding: 28px 20px; font-size: 14px; }
  .pdf-pages { margin-top: 10px; padding: 0 8px; }
  .pdf-page-item { padding: 8px 6px 8px 12px; }
  .pdf-page-num span { display: none; }
  .preview-actions { gap: 3px; }
  .preview-actions .btn { padding: 0 8px; }
  .sheet-table th, .sheet-table td { min-width: 72px; padding: 4px 6px; }
  .sheet-table th.row-head { min-width: 38px; width: 38px; }
}
/* Toasts */
.toast-layer {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #323232;
  color: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  animation: toastIn .2s ease-out;
  line-height: 1.4;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast .icon { width: 19px; height: 19px; margin-top: 1px; color: #a8dab5; }
.toast.error .icon { color: #f6aea9; }
.toast-text { min-width: 0; flex: 1 1 auto; word-break: break-word; }
.toast .toast-close { border: 0; background: transparent; color: #9aa0a6; padding: 0; margin-left: 4px; }
.toast .toast-close:hover { color: #fff; }
.toast-progress { height: 3px; background: rgba(255,255,255,.22); border-radius: 999px; overflow: hidden; margin-top: 7px; }
.toast-progress span { display: block; height: 100%; width: 0; background: #8ab4f8; transition: width .15s; }

/* Drop overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(26,115,232,.12);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.drop-card {
  width: min(520px, 92vw);
  border: 2px dashed var(--blue);
  border-radius: 20px;
  background: rgba(255,255,255,.96);
  padding: 50px 30px;
  text-align: center;
  color: var(--blue);
  font-size: 18px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
}
.drop-card .icon { width: 54px; height: 54px; margin-bottom: 12px; }

/* Utility */
.only-mobile { display: none; }

/* Scrollbars */
.main::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .modal-body::-webkit-scrollbar, .preview-body::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { background: #dadce0; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
.main::-webkit-scrollbar-thumb:hover, .sidebar::-webkit-scrollbar-thumb:hover { background: #bdc1c6; background-clip: content-box; }

/* Responsive */
@media (max-width: 1000px) {
  .sidebar { width: 224px; flex-basis: 224px; }
  .brand-name { display: none; }
}
@media (max-width: 860px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 270px;
    flex-basis: 270px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: none;
    background: var(--bg);
  }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-2); }
  .scrim {
    display: block;
    position: fixed;
    inset: 64px 0 0;
    z-index: 45;
    background: rgba(32,33,36,.35);
  }
  .main { padding: 4px 14px 90px; }
  .brand { padding: 4px; }
  .brand-name { display: none; }
  .search-wrap { height: 44px; }
  .search-wrap input { font-size: 14px; }
  .topbar-actions { gap: 6px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .card .thumb { height: 100px; }
}
@media (max-width: 620px) {
  .topbar { height: 58px; flex-basis: 58px; }
  .only-desktop { display: none !important; }
  .brand-logo.sm { width: 34px; height: 34px; }
  .avatar { width: 36px; height: 36px; font-size: 14px; }
  .search-wrap { margin: 0; }
  .main { padding: 0 10px 90px; }
  .main-head { min-height: 50px; gap: 8px; }
  .crumb { font-size: 18px; padding: 5px 6px; max-width: 220px; }
  .list-header { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .card .thumb { height: 92px; }
  .card .thumb .icon { width: 38px; height: 38px; }
  .row { grid-template-columns: minmax(0,1fr) 40px; min-height: 52px; padding: 0 6px 0 8px; }
  .row-date, .row-size { display: none; }
  .row-more { opacity: 1; }
  .login-card { padding: 26px 22px 22px; border-radius: 16px; }
  .login-card h1 { font-size: 23px; }
  .modal { max-height: calc(100vh - 24px); }
  .modal-layer { padding: 12px; }
  .account-menu { right: 8px; width: calc(100vw - 16px); }
  .preview-head { padding: 8px 8px 8px 12px; }
  #previewName { font-size: 13px; }
  .preview-actions .btn.ghost span { display: none; }
  .toast-layer { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
