:root {
  --blue: #0b57d0;
  --blue-soft: #c2e7ff;
  --ink: #1f1f1f;
  --muted: #5e5e5e;
  --line: #c7c7c7;
  --page: #f7f9fc;
  --hover: #f0f4f9;
  --shadow: 0 1px 2px rgba(60, 64, 67, .22), 0 2px 6px 2px rgba(60, 64, 67, .12);
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--page); font-size: 14px; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }


.app-shell { display: grid; grid-template: 64px minmax(0, 1fr) / 256px minmax(0, 1fr); height: 100vh; min-height: 560px; transition: grid-template-columns .2s ease; }
.topbar { grid-column: 1 / -1; display: grid; grid-template-columns: 256px minmax(260px, 720px) 1fr; align-items: center; gap: 18px; height: 64px; padding: 8px 16px 8px 12px; background: var(--page); z-index: 10; }
.brand-area, .brand, .top-actions, .content-header, .view-actions, .breadcrumb, .view-toggle, .file-name-cell, .preview-topbar, .preview-file-heading, .preview-actions, .notice { display: flex; align-items: center; }
.brand-area { gap: 6px; }
.brand { gap: 10px; color: #444746; font-size: 22px; text-decoration: none; }
.brand-mark { position: relative; display: inline-grid; place-items: center; width: 30px; height: 27px; border: 7px solid #0f9d58; border-top-color: #f4b400; border-right-color: #4285f4; border-radius: 6px; transform: skew(-10deg); }
.brand-mark span { width: 7px; height: 7px; background: #fff; border-radius: 2px; }

.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 21px; cursor: pointer; }
.icon-button:hover, .icon-button:focus-visible { background: #e7e9ec; }
.menu-button span { font-size: 24px; line-height: 1; transform: translateY(-1px); }
.search { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; width: 100%; height: 48px; border-radius: 24px; background: #e9eef6; transition: background .18s, box-shadow .18s; }
.search:focus-within { background: white; box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); }
.search-icon { justify-self: center; width: 16px; height: 16px; border: 2px solid #444746; border-radius: 50%; position: relative; }
.search-icon::after { content: ""; position: absolute; right: -5px; bottom: -3px; width: 7px; height: 2px; background: #444746; transform: rotate(45deg); border-radius: 2px; }
.search input { min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search input::placeholder { color: #444746; opacity: 1; }
.search-options { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; font-size: 20px; cursor: pointer; transform: rotate(90deg); }
.search-options:hover { background: #dfe3ea; }
.top-actions { justify-content: flex-end; gap: 4px; }
.avatar { width: 34px; height: 34px; margin-left: 8px; border: 0; border-radius: 50%; background: #7e57c2; color: white; font-weight: 700; cursor: pointer; box-shadow: inset 0 0 0 2px white, 0 0 0 1px #d5d8dc; }

.sidebar { grid-row: 2; position: relative; padding: 8px 12px 16px 0; background: var(--page); overflow-y: auto; z-index: 8; transition: transform .2s ease, visibility .2s ease; }
.new-button { display: flex; align-items: center; gap: 10px; height: 56px; margin: 0 0 16px 16px; padding: 0 22px 0 16px; border: 0; border-radius: 16px; background: white; box-shadow: var(--shadow); font-weight: 600; cursor: pointer; transition: box-shadow .18s, background .18s; }
.new-button:hover { background: #f8fafd; box-shadow: 0 2px 3px rgba(60,64,67,.25), 0 4px 8px 3px rgba(60,64,67,.13); }
.plus { font-size: 30px; font-weight: 300; }
.new-menu { position: absolute; top: 68px; left: 16px; width: 230px; padding: 8px 0; border-radius: 4px; background: white; box-shadow: var(--shadow); z-index: 20; }
.new-menu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 20px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.new-menu button:hover, .new-menu button:focus-visible { background: var(--hover); }
.new-menu hr { margin: 7px 0; border: 0; border-top: 1px solid #e1e3e1; }
.new-menu span { width: 20px; font-size: 18px; text-align: center; }
.nav-list { display: grid; }
.nav-item { display: grid; grid-template-columns: 36px 1fr 18px; align-items: center; min-height: 40px; padding: 0 14px 0 24px; border: 0; border-radius: 0 22px 22px 0; background: transparent; text-align: left; cursor: pointer; }
.nav-item:hover { background: #e9edf3; }
.nav-item.active { background: var(--blue-soft); font-weight: 700; }
.nav-icon { width: 22px; color: #444746; font-size: 18px; text-align: center; }
.chevron { justify-self: end; font-size: 22px; }
.storage-block { margin: 12px 16px 0 24px; color: #5f6368; font-size: 12px; }
.storage-track { height: 4px; overflow: hidden; border-radius: 3px; background: #d8dbe0; }
.storage-track span { display: block; width: 0; height: 100%; background: var(--blue); transition: width .35s; }
.storage-block p { margin: 9px 0; }

.main-panel { grid-row: 2; min-width: 0; padding: 0 16px 16px 0; }
.content-card { height: 100%; min-height: 0; padding: 18px 24px 0; border-radius: 16px; background: white; overflow: hidden; }
.content-header { justify-content: space-between; min-height: 46px; gap: 20px; }
.breadcrumb { gap: 7px; }
.back-button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 22px; cursor: pointer; }
.back-button:hover { background: var(--hover); }
.breadcrumb h1 { margin: 0; font-size: 24px; font-weight: 500; }
.breadcrumb > span { color: #444746; font-size: 18px; }
.folder-summary { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.view-actions { gap: 12px; }
.view-toggle { overflow: hidden; height: 32px; border: 1px solid #747775; border-radius: 18px; }
.view-toggle button { width: 50px; height: 32px; border: 0; background: transparent; cursor: pointer; font-size: 19px; }
.view-toggle button + button { border-left: 1px solid #747775; }
.view-toggle button.selected { background: var(--blue-soft); color: var(--blue); }
.info-button { font-size: 19px; }
.filters { display: flex; gap: 8px; min-height: 56px; align-items: center; }
.filters button { height: 32px; padding: 0 13px; border: 1px solid #747775; border-radius: 8px; background: white; cursor: pointer; }
.filters button:hover { background: #f7f9fc; }
.filters button.active-filter { border-color: var(--blue); background: #e8f0fe; color: var(--blue); }
.filters span { margin-left: 5px; font-size: 12px; }
.notice { justify-content: space-between; gap: 18px; margin: 0 0 12px; padding: 11px 14px; border: 1px solid #f3b9b5; border-radius: 10px; background: #fce8e6; color: #7d1a14; }
.notice p { margin: 3px 0 0; }
.notice button { flex: none; padding: 7px 13px; border: 1px solid #a50e0e; border-radius: 6px; background: transparent; color: #8c1d18; cursor: pointer; font-weight: 600; }

.file-surface { height: calc(100% - 116px); min-height: 220px; overflow: auto; }
.table-header, .file-row { display: grid; grid-template-columns: minmax(280px, 2.2fr) minmax(130px, 1fr) minmax(155px, 1fr) minmax(90px, .6fr) 42px; align-items: center; }
.table-header { position: sticky; top: 0; height: 48px; border-bottom: 1px solid var(--line); background: white; color: #444746; font-size: 12px; z-index: 2; }
.table-header button { width: max-content; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.file-row { min-height: 48px; border-bottom: 1px solid #dadce0; cursor: default; outline: none; }
.file-row:hover, .file-row:focus-visible { background: var(--hover); }
.file-row.selected { background: #d3e3fd; }
.file-row > * { min-width: 0; }
.file-name-cell { gap: 14px; padding-left: 7px; }
.file-name-wrap { min-width: 0; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-type-mobile { display: none; color: var(--muted); font-size: 12px; }
.file-owner, .file-modified, .file-size { overflow: hidden; color: #444746; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-icon { --file-color: #5f6368; position: relative; flex: none; display: grid; place-items: center; width: 22px; height: 27px; border: 2px solid var(--file-color); border-radius: 2px; color: var(--file-color); }
.file-icon::before { content: ""; position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-left: 2px solid var(--file-color); border-bottom: 2px solid var(--file-color); background: white; }
.file-icon span { max-width: 18px; margin-top: 6px; font-size: 7px; font-weight: 800; }
.file-icon.folder { width: 25px; height: 18px; border: 0; border-radius: 2px; background: #5f8fd8; }
.file-icon.folder::before { top: -5px; left: 1px; width: 11px; height: 6px; border: 0; border-radius: 2px 2px 0 0; background: #5f8fd8; }
.file-icon.small { transform: scale(.82); }
.file-actions-menu {
  position: fixed;
  z-index: 200;
  display: grid;
  min-width: 160px;
  padding: 6px 0;
  border: 1px solid #ccc;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.file-actions-menu button {
  padding: 9px 14px;
  border: 0;
  background: white;
  text-align: left;
  cursor: pointer;
}

.file-actions-menu button:hover {
  background: #eee;
}

.file-actions-menu button.danger {
  color: #b3261e;
}
.filter-menu { position: fixed; z-index: 210; display: grid; min-width: 190px; max-height: 300px; overflow-y: auto; padding: 6px 0; border: 1px solid #ccc; border-radius: 6px; background: white; box-shadow: var(--shadow); }
.filter-menu button { padding: 9px 14px; border: 0; background: white; text-align: left; cursor: pointer; }
.filter-menu button:hover, .filter-menu button.selected { background: var(--hover); }
.filter-menu button.selected::after { content: "✓"; float: right; color: var(--blue); }
.more-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; font-size: 20px; cursor: pointer; }
.more-button:hover { background: #dfe3e7; }

.grid-mode .table-header { display: none; }
.grid-mode .files { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 12px 4px 22px; }
.grid-mode .file-row { position: relative; display: block; min-height: 200px; overflow: hidden; border: 1px solid #e2e5e8; border-radius: 12px; background: #f8fafd; }
.grid-mode .file-row:hover { box-shadow: 0 1px 4px rgba(60,64,67,.25); }
.grid-mode .file-name-cell { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; padding: 0 48px 0 14px; background: white; }
.grid-mode .file-icon { transform: scale(.86); }
.grid-mode .file-row::before { content: attr(data-preview-label); position: absolute; inset: 0 0 52px; display: grid; place-items: center; color: #7a7f86; font-size: 34px; font-weight: 700; letter-spacing: .08em; }
.grid-mode .file-owner, .grid-mode .file-modified, .grid-mode .file-size { display: none; }
.grid-mode .more-button { position: absolute; right: 8px; bottom: 9px; z-index: 1; }

.skeleton-row { display: grid; grid-template-columns: 40px 2fr 1fr 1fr .6fr; align-items: center; height: 48px; border-bottom: 1px solid #edf0f2; }
.skeleton-row span { display: block; width: 70%; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #edf0f3 20%, #f8f9fa 45%, #edf0f3 70%); background-size: 250% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton-row span:first-child { width: 24px; height: 24px; }
@keyframes shimmer { to { background-position: -250% 0; } }
.empty-state { height: calc(100% - 116px); min-height: 260px; padding-top: 90px; text-align: center; color: #444746; }
.empty-state h2 { margin: 22px 0 6px; font-size: 18px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-illustration { position: relative; width: 108px; height: 70px; margin: auto; border-radius: 9px; background: #d6e6ff; transform: rotate(-3deg); }
.empty-illustration::before { content: ""; position: absolute; left: 7px; top: -14px; width: 45px; height: 20px; border-radius: 6px 6px 0 0; background: #accbfa; }
.empty-illustration span { position: absolute; inset: 18px 30px; border: 4px solid white; border-top: 0; border-radius: 0 0 18px 18px; }

.preview-dialog { width: min(1040px, calc(100vw - 48px)); height: min(760px, calc(100vh - 48px)); padding: 0; border: 0; border-radius: 12px; background: #202124; color: white; box-shadow: 0 12px 40px rgba(0,0,0,.38); overflow: hidden; }
.preview-dialog::backdrop { background: rgba(20, 22, 25, .72); }
.preview-topbar { justify-content: space-between; height: 60px; padding: 0 14px 0 20px; background: #292a2d; }
.preview-file-heading { gap: 12px; min-width: 0; }
.preview-file-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-actions { gap: 8px; }
.preview-actions button { height: 36px; padding: 0 14px; border: 1px solid #6f7277; border-radius: 5px; background: transparent; color: white; cursor: pointer; }
.preview-actions .dialog-close { width: 38px; padding: 0; border: 0; border-radius: 50%; font-size: 28px; }
.preview-actions button:hover { background: #3c4043; }
.preview-body { display: grid; place-items: center; height: calc(100% - 60px); overflow: auto; color: #e8eaed; }
.preview-body iframe, .preview-body img, .preview-body video { display: block; max-width: 100%; max-height: 100%; border: 0; }
.preview-body iframe { width: 100%; height: 100%; background: white; }
.preview-placeholder { max-width: 420px; padding: 32px; text-align: center; }
.preview-placeholder .file-icon { margin: 0 auto 20px; transform: scale(2); }
.preview-placeholder p { margin: 28px 0 0; color: #bdc1c6; line-height: 1.5; }
.app-dialog { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.app-dialog::backdrop { background: rgba(32,33,36,.45); }
.app-dialog-header { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 18px; border-bottom: 1px solid #e1e3e1; }
.app-dialog-header h2 { margin: 0; font-size: 19px; font-weight: 500; }
.app-dialog-header button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 25px; cursor: pointer; }
.app-dialog-header button:hover { background: var(--hover); }
.app-dialog-body { padding: 18px; line-height: 1.55; }
.app-dialog-body p:first-child { margin-top: 0; }
.app-dialog-body p:last-child { margin-bottom: 0; }
.app-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 18px 16px; }
.app-dialog-actions button { padding: 8px 14px; border: 1px solid #747775; border-radius: 5px; background: white; cursor: pointer; }
.app-dialog-actions button.primary { border-color: var(--blue); background: var(--blue); color: white; }
.details-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.details-list dt { color: var(--muted); }
.details-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.setting-group { display: grid; gap: 8px; margin-top: 14px; }
.setting-group strong { font-size: 13px; }
.setting-group button { width: 100%; padding: 9px 12px; border: 1px solid #b8babc; border-radius: 5px; background: white; text-align: left; cursor: pointer; }
.setting-group button.selected { border-color: var(--blue); background: #e8f0fe; color: var(--blue); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 6px; background: #323232; color: white; box-shadow: var(--shadow); transform: translateX(-50%); }

@media (min-width: 641px) {
  .app-shell.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .app-shell.sidebar-collapsed .topbar { grid-template-columns: 48px minmax(260px, 720px) 1fr; }
  .app-shell.sidebar-collapsed .brand { display: none; }
  .app-shell.sidebar-collapsed .sidebar { visibility: hidden; transform: translateX(-100%); }
  .app-shell.sidebar-collapsed .main-panel { padding-left: 16px; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .topbar { grid-template-columns: 76px minmax(220px, 1fr) auto; }
  .brand { display: none; }
  .sidebar { padding-right: 8px; }
  .new-button { width: 56px; padding: 0; justify-content: center; border-radius: 16px; }
  .new-button > span:last-child, .nav-item > span:not(.nav-icon) { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; border-radius: 0 22px 22px 0; }
  .storage-block { display: none; }
  .new-menu { position: fixed; top: 124px; }
  .table-header, .file-row { grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) 42px; }
  .table-header > :nth-child(2), .table-header > :nth-child(4), .file-owner, .file-size { display: none; }
}

@media (max-width: 640px) {
  .app-shell { display: block; height: 100vh; }
  .topbar { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; height: 116px; padding: 8px 12px 10px; gap: 7px; }
  .brand-area { grid-column: 1; grid-row: 1; }
  .search { grid-column: 1 / -1; grid-row: 2; height: 46px; }
  .top-actions { grid-column: 3; grid-row: 1; }
  .top-actions .icon-button { display: none; }
  .avatar { margin-left: 0; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 272px; padding-top: 18px; background: white; box-shadow: 4px 0 18px rgba(0,0,0,.18); transform: translateX(-105%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar .new-button { width: auto; padding: 0 22px 0 16px; justify-content: flex-start; }
  .sidebar .new-button > span:last-child, .sidebar .nav-item > span:not(.nav-icon) { display: inline; }
  .sidebar .nav-item { grid-template-columns: 36px 1fr 18px; justify-items: stretch; padding: 0 14px 0 24px; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 7; background: rgba(0,0,0,.32); }
  .main-panel { height: calc(100vh - 116px); padding: 0 8px 8px; }
  .content-card { padding: 14px 14px 0; border-radius: 14px; }
  .breadcrumb h1 { font-size: 21px; }
  .folder-summary, .info-button { display: none; }
  .filters { min-height: 52px; overflow-x: auto; }
  .filters button { flex: none; }
  .file-surface { height: calc(100% - 98px); }
  .table-header { display: none; }
  .file-row { grid-template-columns: minmax(0, 1fr) 40px; min-height: 64px; }
  .file-owner, .file-modified, .file-size { display: none; }
  .file-name-cell { padding-left: 4px; }
  .file-type-mobile { display: block; margin-top: 4px; }
  .grid-mode .files { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .grid-mode .file-row { min-height: 158px; }
  .preview-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
