:root {
  --bg: #f8f9fa;
  --bg2: #f1f3f4;
  --card: #fff;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --accent: #1a73e8;
  --accent-dark: #1765cc;
  --danger: #d93025;
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Roboto', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding-top: 12px; position: sticky; top: 0; height: 100vh; }
.drive-brand { display: flex; align-items: center; gap: 10px; padding: 8px 24px; font-size: 1.5rem; font-weight: 500; color: var(--text); margin-bottom: 24px; }
.drive-logo { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #ffd95c; color: #1a73e8; }
.brand-name { color: #5f6368; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.side-nav a { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 0 25px 25px 0; color: var(--text); font-size: 0.95rem; }
.side-nav a:hover { background: var(--bg2); }
.side-nav a.active { background: #e8f0fe; color: var(--accent); font-weight: 500; }
.nav-ico { font-size: 1.1rem; }
.side-storage { margin-top: auto; padding: 16px 24px; font-size: 0.8rem; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; gap: 16px; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.search { position: relative; display: flex; align-items: center; }
.search input { width: 480px; max-width: 70vw; padding: 9px 12px 9px 40px; border: 1px solid var(--border); border-radius: 24px; background: var(--bg2); font-size: 0.95rem; }
.search-ico { position: absolute; left: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { border: none; background: transparent; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-size: 1.2rem; }
.icon-btn:hover { background: var(--bg2); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 500; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; }
.inline { display: inline; }
.content { padding: 16px 24px; }

/* Toolbar */
.drive-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.drive-breadcrumb { font-size: 1.2rem; font-weight: 400; color: var(--text); }
.drive-breadcrumb .sep { margin: 0 6px; color: var(--muted); }
.drive-breadcrumb .cur { font-weight: 500; }
.drive-actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.btn:hover { background: var(--bg2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }

/* Drive list */
.drive-view { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.drive-list-head, .drive-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px 160px 120px 48px; align-items: center; gap: 8px; padding: 8px 16px; }
.drive-list-head { background: var(--bg2); color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.drive-row { border-top: 1px solid var(--border); cursor: pointer; }
.drive-row:hover { background: #f8f9fa; }
.drive-row.active { background: #e8f0fe; }
.col-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.col-name .name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-ico { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; font-size: 1.15rem; flex-shrink: 0; }
.col-owner, .col-date, .col-size { font-size: 0.9rem; color: var(--muted); }
.col-menu { text-align: right; }
.row-menu { width: 32px; height: 32px; }
.muted { color: var(--muted); }

.upload-overlay { position: fixed; inset: 0; background: rgba(26,115,232,.08); pointer-events: none; z-index: 100; }
.upload-drop { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 12px 24px; border-radius: 24px; font-weight: 500; box-shadow: var(--shadow); }

.context-menu { position: absolute; z-index: 200; background: #fff; border-radius: 8px; box-shadow: var(--shadow); min-width: 200px; padding: 6px 0; }
.context-menu a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--text); }
.context-menu a:hover { background: var(--bg2); }
.context-menu a.danger { color: var(--danger); }

.flash { background: #e8f0fe; border-left: 4px solid var(--accent); color: var(--text); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash.error { background: #fce8e6; border-left-color: var(--danger); }

.auth-card { max-width: 400px; margin: 40px auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }
.auth-card h1 { margin-top: 0; font-size: 1.6rem; }
.auth-card label { display: block; margin-bottom: 16px; font-size: 0.9rem; color: var(--muted); }
.auth-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; font-size: 1rem; }

.card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 24px; }

.file-header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.file-title { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 500; }
.file-actions { margin-left: auto; display: flex; gap: 8px; }
.file-meta { margin-bottom: 24px; }
.editor-wrap { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
#onlyoffice-editor { height: calc(100vh - 200px); }

.drive-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-ico { font-size: 3rem; margin-bottom: 12px; }

.error-page { text-align: center; padding: 60px; }
.error-page h1 { font-size: 3rem; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .drive-list-head { grid-template-columns: minmax(0,1fr) 60px; }
  .col-owner, .col-date, .col-size { display: none; }
  .drive-list-head, .drive-row { grid-template-columns: minmax(0,1fr) 48px; }
}
