/* jettfiles — dark by default [UI-1], Drive-style layout [UI-2] */

:root, [data-theme="dark"] {
  --bg: #131316;
  --sidebar: #131316;
  --surface: #1e1f23;
  --surface-2: #26272c;
  --hover: #2c2d33;
  --selected: #23344f;
  --selected-border: #4f7fd6;
  --border: #33343a;
  --text: #e4e5e9;
  --muted: #9b9ca5;
  --accent: #8ab4f8;
  --accent-text: #0b1b36;
  --danger: #f28b82;
  --danger-text: #2d0b08;
  --error-bg: #3c1d1d;
  --error-text: #ffb4ab;
  --success-bg: #17352a;
  --success-text: #a8dab5;
  --folder: #a3a8b3;
  --shadow: 0 4px 16px rgba(0, 0, 0, .5);
  --scrim: rgba(0, 0, 0, .5);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f8fafd;
  --sidebar: #f8fafd;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --hover: #e9edf3;
  --selected: #c2e7ff;
  --selected-border: #0b57d0;
  --border: #dde1e7;
  --text: #1f1f1f;
  --muted: #5e6470;
  --accent: #0b57d0;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --danger-text: #ffffff;
  --error-bg: #fce8e6;
  --error-text: #8c1d18;
  --success-bg: #e6f4ea;
  --success-text: #0d652d;
  --folder: #5f6368;
  --shadow: 0 4px 16px rgba(0, 0, 0, .15);
  --scrim: rgba(0, 0, 0, .3);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 "Google Sans Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon.big { width: 48px; height: 48px; }

/* --- Buttons and inputs --- */
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; font-weight: 500; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.danger { background: var(--danger); color: var(--danger-text); border-color: transparent; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.08); background: var(--danger); }
.btn.danger-outline { color: var(--danger); }
.btn.small { padding: 4px 12px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-btn.active { background: var(--selected); color: var(--text); }
input, select {
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible,
.listing:focus-visible, .item:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.alert { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert.success { background: var(--success-bg); color: var(--success-text); }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 500; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand.big { font-size: 24px; margin-bottom: 4px; }

/* --- Login --- */
.auth-card {
  max-width: 380px; margin: 12vh auto 0; padding: 36px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.auth-card .btn { margin-top: 6px; }

/* --- App shell: sidebar + main column --- */
.shell { display: flex; height: 100%; }
.sidebar {
  width: 256px; flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 12px 16px; background: var(--sidebar); overflow-y: auto;
}
.sidebar .brand { padding: 8px 12px 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 14px; padding: 7px 16px;
  border-radius: 999px; color: var(--text);
}
.side-link:hover { background: var(--hover); text-decoration: none; }
.side-link.active { background: var(--selected); font-weight: 600; }
.side-heading { padding: 14px 16px 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.storage { padding: 12px 16px; margin-top: 4px; }
.storage-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-bottom: 6px; }
.storage-fill { height: 100%; width: 0; background: var(--accent); }
.storage-text { color: var(--muted); font-size: 12.5px; }

.main-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface); margin: 0 12px 12px 0; border-radius: 16px; overflow: hidden;
  margin-top: 12px;
}
.topbar {
  display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 12px 8px 20px;
}
.topbar-title { flex: 1; min-width: 0; }
.page-title { font-size: 22px; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.avatar {
  width: 34px; height: 34px; margin-left: 4px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-text); font-weight: 600;
}
.user-menu-wrap { position: relative; }
.acting-banner {
  margin: 0 20px 4px; padding: 8px 14px; border-radius: 10px;
  background: var(--selected); font-size: 13.5px;
}
.content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 20px 20px; overflow: hidden; }
.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }

/* --- Breadcrumbs --- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 22px; min-width: 0; }
.crumbs.small { font-size: 14px; margin-bottom: 8px; }
.crumb {
  border: 0; background: none; padding: 4px 10px; border-radius: 999px;
  color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.current { color: var(--text); }
.crumb-sep { color: var(--muted); width: 18px; height: 18px; }

/* --- Toolbar --- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 0 12px; flex-wrap: wrap;
}
.sort-controls, .view-toggle { display: flex; align-items: center; gap: 4px; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-left .btn { padding: 6px 16px 6px 12px; }
.view-toggle { border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.view-toggle .icon-btn { width: 36px; height: 32px; border-radius: 999px; }
.sort-controls select { padding: 6px 10px; border-radius: 999px; }
.bin-note { margin: 0; }

/* --- Listing --- */
.drop-zone { position: relative; flex: 1; min-height: 0; display: flex; }
.listing { flex: 1; overflow-y: auto; min-height: 0; border-radius: 8px; }
.drop-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; border: 2px dashed var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); pointer-events: none;
}
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; height: 100%; min-height: 240px; color: var(--muted); text-align: center;
}
.empty .icon { width: 72px; height: 72px; opacity: .5; }
.loading { padding: 24px; color: var(--muted); }

/* List view (table) */
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
/* Bin and admin tables size columns to content so the name never gets squeezed out. */
.table.auto { table-layout: auto; }
.table.auto .row-actions { flex-wrap: nowrap; }
.table.auto td:first-child { max-width: 0; width: 100%; min-width: 140px; }
.table.auto th:not(:first-child), .table.auto td:not(:first-child) { width: 1%; }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  text-align: left; font-weight: 500; color: var(--muted); font-size: 13px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th button { border: 0; background: none; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; color: inherit; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.table th button:hover { background: var(--hover); color: var(--text); }
.table th .icon { width: 16px; height: 16px; }
.table td { padding: 0 12px; height: 48px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .col-date { width: 180px; }
.table .col-size { width: 110px; }
.table .col-days { width: 120px; }
.table .col-status { width: 110px; }
.table .col-actions { width: 64px; text-align: right; text-overflow: clip; }
.table .col-wide-actions { width: 340px; text-align: right; }
.item { cursor: default; user-select: none; }
tr.item:hover td { background: var(--hover); }
.item.selected td, .card.item.selected { background: var(--selected); }
.name-cell { display: flex; align-items: center; gap: 14px; min-width: 0; }
.name-cell span { overflow: hidden; text-overflow: ellipsis; }
.kind-icon { color: var(--folder); }
.kind-icon.image { color: #e8711a; }
.kind-icon.pdf { color: #ea4335; }
.kind-icon.text { color: #4285f4; }
.kind-icon.archive { color: #a5a5a5; }
.kind-icon.media { color: #d93025; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions .icon-btn { width: 34px; height: 34px; }

/* Grid view */
.grid-section { margin-bottom: 20px; }
.grid-heading { font-size: 14px; font-weight: 500; margin: 4px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; border-radius: 12px;
  background: var(--surface-2); overflow: hidden;
}
.card:hover { background: var(--hover); }
.card.folder { flex-direction: row; align-items: center; gap: 12px; padding: 0 6px 0 16px; height: 48px; }
.card.folder .name { flex: 1; }
.card .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; }
.card-head .name { flex: 1; }
.card-preview {
  display: grid; place-items: center; height: 120px; margin: 0 8px 8px; border-radius: 8px; background: var(--surface);
}
.card-preview .icon { width: 56px; height: 56px; }
.card-meta { padding: 0 14px 10px; color: var(--muted); font-size: 12.5px; }
.card .icon-btn { width: 32px; height: 32px; }

/* --- Menus --- */
.menu {
  position: absolute; z-index: 60; min-width: 220px; padding: 8px 0;
  background: var(--surface-2); border-radius: 8px; box-shadow: var(--shadow);
}
#user-menu { right: 0; top: 44px; }
.context-menu { position: fixed; }
.menu-heading { padding: 6px 16px 8px; color: var(--muted); font-size: 12.5px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 16px;
  border: 0; background: none; text-align: left; color: var(--text);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); text-decoration: none; outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; margin: 6px 0; background: var(--border); }
.menu form { margin: 0; }

/* --- Dialogs --- */
.dialog {
  width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 24px;
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow);
}
.dialog.wide { width: min(520px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--scrim); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog-title { margin: 0; font-size: 20px; word-break: break-word; }
.dialog-message { margin: 0; color: var(--muted); }
.dialog-error { margin: 0; color: var(--error-text); background: var(--error-bg); padding: 8px 10px; border-radius: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.choice { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.radio {
  flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
}
.radio:has(input:checked) { border-color: var(--selected-border); background: var(--selected); }
.radio input { margin-top: 3px; }
.picker {
  list-style: none; margin: 0; padding: 0; height: 260px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 12px;
}
.picker li button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px;
  border: 0; background: none; text-align: left;
}
.picker li button:hover { background: var(--hover); }
.picker li button:disabled { opacity: .4; }
.picker .empty-note { padding: 16px; color: var(--muted); }

/* --- Uploads panel --- */
.uploads {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface-2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.uploads-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 18px; font-weight: 500; }
.uploads-list { list-style: none; margin: 0; padding: 0 0 8px; max-height: 260px; overflow-y: auto; }
.uploads-list li { display: flex; align-items: center; gap: 12px; padding: 8px 18px; }
.uploads-list .up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads-list .up-status { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.uploads-list .up-status.error { color: var(--error-text); white-space: normal; text-align: right; max-width: 55%; }
.uploads-list .up-status.done { color: var(--success-text); }
.up-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; width: 60px; }
.up-bar div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* --- Toasts --- */
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: 8px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow); max-width: 420px;
}
.toast.error { background: var(--error-bg); color: var(--error-text); }

/* --- Cards / account --- */
.card.narrow { max-width: 440px; padding: 24px; background: var(--surface-2); border-radius: 16px; }
.card.narrow h2 { margin-top: 0; font-size: 18px; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; background: var(--success-bg); color: var(--success-text); }
.status-pill.removed { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* --- Narrow screens --- */
@media (max-width: 1100px) {
  .table .col-date { width: 120px; }
  .table.auto .col-date { display: none; }
}
@media (max-width: 720px) {
  .toolbar-left .btn { padding: 6px 10px; }
  .toolbar-left .btn-label { display: none; }
  .only-mobile { display: inline-grid; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 45; transform: translateX(-100%);
    transition: transform .2s; box-shadow: var(--shadow); background: var(--surface);
  }
  .sidebar.open { transform: none; }
  .main-col { margin: 0; border-radius: 0; }
  .topbar { padding: 8px 8px 8px 4px; }
  .content { padding: 0 16px 16px; }
  .acting-banner { margin: 0 16px 4px; }
  .crumbs { font-size: 18px; }
  .page-title { font-size: 18px; }
  .table .col-date, .table .col-size, .table .col-days, .table .col-status { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .card-preview { height: 90px; }
  .auth-card { margin: 16px; padding: 28px 22px; }
  .uploads { right: 16px; bottom: 16px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
}
