/* Drive Manager — clean, phone-friendly, no build step. */
:root {
  --bg: #f6f8fb; --card: #fff; --ink: #1a1d21; --muted: #667085;
  --line: #e4e7ec; --brand: #1a73e8; --brand-dark: #1557b0;
  --danger: #b3261e; --amber: #f9ab00; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; }
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .95rem; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error { color: var(--danger); background: #fdecea; padding: .6rem .8rem; border-radius: var(--radius); }
.hidden { display: none !important; }
code { background: #eef2f7; padding: .1rem .35rem; border-radius: 4px; word-break: break-all; }
label { display: block; font-weight: 600; margin: .7rem 0 .25rem; font-size: .9rem; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line);
  border-radius: 8px; font-size: 1rem; background: #fff; }
button, .btn { cursor: pointer; }
.btn { display: inline-block; padding: .5rem .8rem; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; font-size: .92rem; text-decoration: none; color: var(--ink); }
.btn:hover { background: #eef2f7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #f3c2bf; }
.btn.block { display: block; width: 100%; margin-top: .7rem; }
.icon-btn { background: none; border: none; font-size: 1.1rem; padding: .4rem; }

/* Login */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.login-card { background: var(--card); padding: 1.6rem; border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 100%; max-width: 380px; }

/* Top bar */
.topbar { display: flex; gap: .6rem; align-items: center; padding: .6rem .8rem;
  background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.account-switcher { display: flex; gap: .4rem; align-items: center; flex: 1; min-width: 220px; }
.account-switcher select { width: auto; flex: 1; }
.top-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.badge { background: var(--amber); color: #000; border-radius: 999px; padding: 0 .45rem; font-size: .8rem; }

.banner { background: #fef3c7; color: #7c4a03; padding: .6rem .9rem; font-size: .92rem; }
.banner a { color: #7c4a03; font-weight: 700; }
.quota { padding: .45rem .9rem; background: var(--card); border-bottom: 1px solid var(--line); font-size: .88rem; }
.quota-track { height: 6px; background: var(--line); border-radius: 999px; margin-top: .3rem; overflow: hidden; }
.quota-fill { height: 100%; background: var(--brand); width: 0; }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 57px); }
.sidebar { width: 220px; flex-shrink: 0; padding: .8rem; border-right: 1px solid var(--line); background: var(--card); }
.sidebar.open { display: block; }
.nav-btn { display: block; width: 100%; text-align: left; padding: .55rem .7rem;
  margin-bottom: .25rem; background: none; border: none; border-radius: 8px; font-size: .95rem; }
.nav-btn.active, .nav-btn:hover { background: #e8f0fe; }
.search-box { margin-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.sidebar-note { margin-top: 1rem; }
.main { flex: 1; min-width: 0; padding: .8rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
.breadcrumbs { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; min-height: 2rem; }
.breadcrumbs button { background: none; border: none; color: var(--brand); font-size: .95rem; padding: .2rem; }
.breadcrumbs button.current { color: var(--ink); font-weight: 700; cursor: default; }
.toolbar-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.toolbar-actions select { width: auto; }
.selection-bar { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
  background: #e8f0fe; border-radius: var(--radius); padding: .5rem .6rem; margin: .6rem 0; }
.status { margin: .5rem 0; min-height: 1.2em; }

/* File list / grid */
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-row { display: grid; grid-template-columns: 28px 40px 1fr auto auto; gap: .5rem;
  align-items: center; padding: .55rem .6rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.file-row:hover { background: #f0f4f9; }
.file-row.selected { background: #e8f0fe; border-color: var(--brand); }
.file-row .thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.file-row .mime { font-size: 1.4rem; text-align: center; }
.file-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.file-row .meta { color: var(--muted); font-size: .83rem; white-space: nowrap; }
.file-list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.file-list.grid .file-row { grid-template-columns: 1fr; text-align: center; padding: .8rem .5rem; }
.file-list.grid .file-row .name { white-space: normal; }
.file-list.grid .file-row .meta { white-space: normal; }
.file-list.grid .file-row .thumb, .file-list.grid .file-row .mime { margin: 0 auto; width: 56px; height: 56px; font-size: 2.2rem; }

/* Details pane */
.details { width: 300px; flex-shrink: 0; background: var(--card); border-left: 1px solid var(--line); padding: 1rem; }
.details-thumb { max-width: 100%; border-radius: 8px; margin: .5rem 0; }
.details dl { font-size: .9rem; }
.details dt { font-weight: 700; margin-top: .5rem; }
.details dd { margin: 0; color: var(--muted); word-break: break-word; }
.details-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: 1rem; }

/* Modal / drawer / toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex;
  align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal-card { background: #fff; border-radius: 14px; padding: 1.2rem; width: 100%; max-width: 480px; max-height: 85vh; overflow: auto; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.picker-list { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: .5rem; }
.picker-item { display: block; width: 100%; text-align: left; padding: .6rem .7rem; background: none; border: none; border-bottom: 1px solid var(--line); font-size: .95rem; }
.picker-item:hover { background: #eef2f7; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw);
  background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,.15); padding: 1.1rem;
  overflow: auto; z-index: 40; }
.drawer .icon-btn { position: absolute; top: .6rem; right: .6rem; }
.job { border: 1px solid var(--line); border-radius: 10px; padding: .7rem; margin-bottom: .6rem; font-size: .9rem; }
.job .bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: .4rem 0; }
.job .bar > div { height: 100%; background: var(--brand); }
.job .failed { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: #202124; color: #fff; padding: .7rem 1rem; border-radius: 999px; z-index: 60; max-width: 92vw; }

/* Phone */
@media (max-width: 760px) {
  .sidebar { display: none; position: fixed; z-index: 30; top: 57px; bottom: 0; left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.12); }
  .details { position: fixed; right: 0; top: 57px; bottom: 0; z-index: 30; box-shadow: -4px 0 24px rgba(0,0,0,.12); }
  .file-row { grid-template-columns: 28px 36px 1fr auto; }
  .file-row .meta.size-col { display: none; }
  .topbar h1 { display: none; }
}
