/* Drive — world-class CSS
   Clean modern tool feel: two-pane layout, inkwell navy + warm gold accent,
   generous whitespace, Inter/system stack, no decoration that doesn't earn its place.
*/

:root {
  --ink:        #0e1a33;
  --ink-2:      #1f3b73;
  --ink-3:      #3461b5;
  --gold:       #c9a44c;
  --gold-deep:  #8a6a1c;
  --bg:         #fbfaf6;
  --bg-panel:   #ffffff;
  --bg-soft:    #f4f6fb;
  --bg-hover:   #eef2f9;
  --bg-sel:     #e3ecfa;
  --line:       #e5e7ee;
  --line-soft:  #eef0f5;
  --text:       #14213d;
  --text-soft:  #5a6479;
  --text-muted: #8b95a8;
  --danger:     #b3261e;
  --success:    #1a7f37;

  --radius:     10px;
  --radius-sm:  6px;
  --shadow-1:   0 1px 2px rgba(20,33,61,.05), 0 1px 3px rgba(20,33,61,.04);
  --shadow-2:   0 4px 12px rgba(20,33,61,.08), 0 1px 3px rgba(20,33,61,.05);
  --shadow-3:   0 24px 48px rgba(20,33,61,.18);

  --sidebar-w:  260px;
  --topbar-h:   64px;

  --ff: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
dialog:not([open]) { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--ff);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: transparent; color: inherit; }
input, select, textarea {
  font: inherit; color: inherit;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(52,97,181,.15);
}

/* ── Sidebar ───────────────────────────────────────────────── */

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-link {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
  padding: 6px 8px;
}

.new-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--ink-2);
  color: #fff;
  border-radius: 28px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-1);
  transition: background .15s, transform .05s, box-shadow .15s;
  align-self: flex-start;
  margin: 4px 8px 6px;
}
.new-btn:hover { background: var(--ink-3); box-shadow: var(--shadow-2); }
.new-btn:active { transform: translateY(1px); }

.new-menu {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 6px;
  z-index: 30;
  min-width: 200px;
}
.new-menu button {
  display: block; width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.new-menu button:hover { background: var(--bg-hover); }
.new-menu hr { border: none; border-top: 1px solid var(--line-soft); margin: 4px 0; }

.nav {
  display: flex; flex-direction: column;
  gap: 1px;
  margin-top: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  border-radius: 0 22px 22px 0;
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 500;
  margin-right: 8px;
}
.nav-item svg { flex: 0 0 18px; }
.nav-item:hover { background: var(--bg-hover); color: var(--ink); }
.nav-item.active {
  background: var(--bg-sel);
  color: var(--ink-2);
  font-weight: 600;
}

.storage {
  margin-top: auto;
  padding: 12px 10px 6px;
}
.storage-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.storage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ink-3), var(--gold));
  transition: width .25s ease;
}
.storage-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Main ──────────────────────────────────────────────────── */

.main {
  display: flex; flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  background: rgba(251,250,246,.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 20;
  height: var(--topbar-h);
}

.search {
  flex: 1; max-width: 720px;
  display: flex; align-items: center;
  gap: 10px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 28px;
  padding: 8px 16px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.search:focus-within {
  background: #fff;
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(52,97,181,.10);
}
.search svg { color: var(--text-muted); flex: 0 0 16px; }
.search input {
  flex: 1; border: none; padding: 2px 0;
  background: transparent; font-size: 14px;
}
.search input:focus { box-shadow: none; }

.user {
  display: flex; align-items: center; gap: 14px;
  color: var(--text-soft);
}
.user-name { font-weight: 500; }
.user-out {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
}
.user-out:hover { background: var(--bg-hover); color: var(--ink-2); }

/* ── Path / crumbs ─────────────────────────────────────────── */

.path-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 12px;
  gap: 12px;
}
.crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600;
  color: var(--text-soft);
  flex-wrap: wrap;
}
.crumb { padding: 4px 6px; border-radius: 6px; }
.crumb:hover { background: var(--bg-hover); color: var(--ink); }
.crumb.current { color: var(--ink); font-weight: 700; }
.crumb-sep { color: var(--text-muted); font-weight: 400; }

.section-title {
  font-size: 22px; font-weight: 700; margin: 0;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.view-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 2px;
}
.view-toggle button {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
}
.view-toggle button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ── Items ─────────────────────────────────────────────────── */

.items {
  padding: 0 24px 60px;
}

.items.as-list .items-head {
  display: grid;
  grid-template-columns: minmax(0,1fr) 160px 110px 60px;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.items.as-list .items-head .col { display: flex; align-items: center; gap: 6px; }
.items.as-list .items-head .col.sorted-asc::after  { content: '↑'; }
.items.as-list .items-head .col.sorted-desc::after { content: '↓'; }

.items.as-list .item {
  display: grid;
  grid-template-columns: minmax(0,1fr) 160px 110px 60px;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.items.as-list .item:hover { background: var(--bg-hover); }
.items.as-list .item.selected { background: var(--bg-sel); }
.items.as-list .item:focus { outline: 2px solid var(--ink-3); outline-offset: -2px; }

.items.as-list .col-name {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.items.as-list .fname {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.items.as-list .col-modified,
.items.as-list .col-size { color: var(--text-soft); font-size: 13px; }
.items.as-list .col-actions { justify-self: end; }

.items.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 8px 24px 60px;
}
.items.as-grid .items-head { display: none; }
.items.as-grid .item {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow .15s, transform .05s;
  display: flex; flex-direction: column;
  gap: 10px;
  min-height: 160px;
  position: relative;
}
.items.as-grid .item:hover { box-shadow: var(--shadow-2); }
.items.as-grid .col-name { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.items.as-grid .ficon { width: 56px; height: 56px; align-self: center; }
.items.as-grid .fname {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.items.as-grid .col-modified, .items.as-grid .col-size { font-size: 12px; color: var(--text-muted); }
.items.as-grid .col-actions { position: absolute; top: 6px; right: 6px; }

.row-action {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .12s, background .12s;
}
.item:hover .row-action,
.item:focus-within .row-action { opacity: 1; }
.row-action:hover { background: var(--bg-hover); color: var(--ink); }

.star { color: var(--gold); font-size: 14px; margin-left: 6px; }

.hl-snip { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.hl-snip mark { background: rgba(201,164,76,.25); color: var(--ink); padding: 0 2px; border-radius: 3px; }

/* ── File icons (SVG via background-image) ─────────────────── */

.ficon {
  width: 28px; height: 28px;
  flex: 0 0 28px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.ficon-folder  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23c9a44c'><path d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/></svg>"); }
.ficon-image   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f3b73' stroke-width='1.6'><rect x='3' y='5' width='18' height='14' rx='2'/><circle cx='9' cy='10' r='1.5' fill='%231f3b73'/><path d='M3 17l5-5 4 4 3-3 6 6'/></svg>"); }
.ficon-video   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f3b73' stroke-width='1.6'><rect x='3' y='5' width='18' height='14' rx='2'/><path d='M10 9l5 3-5 3z' fill='%231f3b73'/></svg>"); }
.ficon-audio   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f3b73' stroke-width='1.6'><path d='M9 18V6l12-2v12'/><circle cx='6' cy='18' r='3' fill='%231f3b73'/><circle cx='18' cy='16' r='3' fill='%231f3b73'/></svg>"); }
.ficon-pdf     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23b3261e' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path fill='%23fff' d='M14 2v6h6'/><text x='7' y='17' font-family='Arial' font-weight='700' font-size='6' fill='%23b3261e'>PDF</text></svg>"); }
.ficon-doc     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%231f3b73' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path fill='%23fff' d='M14 2v6h6'/><text x='7' y='17' font-family='Arial' font-weight='700' font-size='6' fill='%23fff'>DOC</text></svg>"); }
.ficon-sheet   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%231a7f37' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path fill='%23fff' d='M14 2v6h6'/><text x='7' y='17' font-family='Arial' font-weight='700' font-size='6' fill='%23fff'>XLS</text></svg>"); }
.ficon-slides  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23d97706' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path fill='%23fff' d='M14 2v6h6'/><text x='6' y='17' font-family='Arial' font-weight='700' font-size='6' fill='%23fff'>PPT</text></svg>"); }
.ficon-archive { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a6a1c' stroke-width='1.6'><rect x='3' y='3' width='18' height='18' rx='2'/><path d='M12 3v18M9 6h6M9 9h6M9 12h6'/></svg>"); }
.ficon-text    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f3b73' stroke-width='1.6'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path d='M14 2v6h6M8 13h8M8 17h8M8 9h3'/></svg>"); }
.ficon-code    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233461b5' stroke-width='1.7'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path d='M14 2v6h6'/><path d='M10 12l-2 2 2 2M14 12l2 2-2 2'/></svg>"); }
.ficon-font    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231f3b73'><text x='4' y='18' font-family='Georgia' font-weight='700' font-size='16'>Aa</text></svg>"); }
.ficon-file    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6479' stroke-width='1.6'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path d='M14 2v6h6'/></svg>"); }

/* ── Empty state ───────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty svg { margin-bottom: 18px; }
.empty h3 { color: var(--text-soft); margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.empty p { margin: 0; font-size: 14px; }

/* ── Drop overlay ──────────────────────────────────────────── */

.drop-overlay {
  position: fixed; inset: 0;
  background: rgba(20,33,61,.55);
  display: grid; place-items: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.drop-card {
  background: #fff;
  padding: 60px 80px;
  border-radius: 16px;
  text-align: center;
  color: var(--ink-2);
  border: 3px dashed var(--ink-3);
  box-shadow: var(--shadow-3);
}
.drop-card p { font-size: 18px; font-weight: 600; margin: 12px 0 0; }

/* ── Upload tray ───────────────────────────────────────────── */

.upload-tray {
  position: fixed; right: 24px; bottom: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
  width: 360px; max-width: calc(100vw - 32px);
  overflow: hidden;
  z-index: 90;
}
.upload-tray-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--ink-2);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.upload-tray-head button { color: #fff; font-size: 18px; }
.upload-tray ul {
  list-style: none; margin: 0; padding: 6px 0;
  max-height: 280px; overflow-y: auto;
}
.upload-tray li {
  padding: 8px 14px;
  font-size: 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
}
.upload-tray .upload-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.upload-tray .upload-status { color: var(--text-muted); font-size: 12px; justify-self: end; }
.upload-tray .upload-bar {
  grid-column: 1 / -1;
  height: 3px; background: var(--bg-hover); border-radius: 2px; overflow: hidden;
}
.upload-tray .upload-bar span {
  display: block; height: 100%; background: var(--ink-3); transition: width .2s;
}
.upload-tray .upload-status.done { color: var(--success); }
.upload-tray .upload-status.err  { color: var(--danger); }

/* ── Context menu ──────────────────────────────────────────── */

.context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-3);
  padding: 6px;
  min-width: 200px;
  z-index: 200;
}
.context-menu button {
  display: block; width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.context-menu button:hover { background: var(--bg-hover); }
.context-menu hr { border: none; border-top: 1px solid var(--line-soft); margin: 4px 0; }
.context-menu .danger { color: var(--danger); }
.context-menu .danger:hover { background: #fde7e5; }

/* ── Dialogs ───────────────────────────────────────────────── */

dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 92vw;
}
dialog::backdrop { background: rgba(20,33,61,.55); backdrop-filter: blur(2px); }
dialog form {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-3);
  min-width: 380px;
  max-width: 520px;
}
dialog h3 { margin: 0 0 14px; font-size: 18px; color: var(--ink); }
dialog h4 { margin: 14px 0 8px; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
dialog hr { border: none; border-top: 1px solid var(--line-soft); margin: 14px 0; }
dialog input[type=text], dialog input[type=email], dialog input[type=password], dialog input[type=number], dialog select {
  width: 100%;
}
.dialog-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 16px;
}
.dialog-actions button {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-soft);
  font-weight: 500;
}
.dialog-actions button:hover { background: var(--bg-hover); }
.dialog-actions .primary, button.primary {
  background: var(--ink-2); color: #fff;
}
.dialog-actions .primary:hover, button.primary:hover { background: var(--ink-3); }

.share-link-row { display: flex; gap: 8px; }
.share-link-row input { flex: 1; }
.share-link-row button { padding: 8px 14px; background: var(--bg-soft); border-radius: 8px; }
.share-link-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.share-link-controls #share-link-create { grid-column: 1 / -1; padding: 10px; }
.share-add { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; }
.share-add button { background: var(--bg-soft); padding: 8px 14px; border-radius: 8px; }

#share-recipients .recip {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

/* ── Preview dialog ────────────────────────────────────────── */

.preview-dialog {
  width: 90vw; max-width: 1200px; height: 86vh;
}
.preview-dialog::backdrop { background: rgba(14,26,51,.85); }
.preview-dialog .preview-head, .preview-dialog .preview-body { background: #0e1a33; }
.preview-dialog[open] {
  background: #0e1a33;
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.preview-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.preview-actions { display: flex; gap: 12px; align-items: center; }
.preview-actions a { color: #fff; padding: 6px 14px; border-radius: 6px; background: rgba(255,255,255,.1); font-size: 13px; }
.preview-actions a:hover { background: rgba(255,255,255,.18); }
.preview-actions button { color: #fff; font-size: 22px; width: 32px; height: 32px; border-radius: 6px; }
.preview-actions button:hover { background: rgba(255,255,255,.1); }
.preview-body {
  flex: 1;
  display: grid; place-items: center;
  overflow: auto;
}
.preview-body img,
.preview-body video,
.preview-body audio { max-width: 100%; max-height: 100%; }
.preview-body iframe { width: 100%; height: 100%; border: none; background: #fff; }
.preview-body pre {
  margin: 0; padding: 24px;
  width: 100%; height: 100%; overflow: auto;
  color: #d8dde7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #0e1a33;
}

/* ── Auth pages ────────────────────────────────────────────── */

.auth-body {
  display: grid; place-items: center;
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfaf6, #eef2f9);
  grid-template-columns: 1fr;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow-3);
  width: min(420px, 92vw);
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand h1 { margin: 12px 0 4px; font-size: 28px; color: var(--ink); letter-spacing: -0.01em; }
.auth-brand p { margin: 0; color: var(--text-muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { font-size: 13px; color: var(--text-soft); font-weight: 500; }
.auth-form input { padding: 11px 14px; font-size: 15px; }
.auth-form .primary { margin-top: 8px; padding: 12px; font-size: 15px; font-weight: 600; border-radius: 8px; }
.auth-error { color: var(--danger); font-size: 13px; margin: 0; }
.auth-hint { color: var(--text-muted); font-size: 12px; text-align: center; margin: 20px 0 0; }

/* ── Share viewer ──────────────────────────────────────────── */

.share-body {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  background: #0e1a33;
  color: #fff;
}
.share-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 16px 28px;
  background: #14213d;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.share-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.share-meta h1 { margin: 0; font-size: 16px; font-weight: 600; }
.share-meta p  { margin: 2px 0 0; color: #b5bdce; font-size: 13px; }
.share-actions a { background: var(--gold); color: #1e1606; padding: 8px 18px; border-radius: 8px; font-weight: 600; }
.share-actions a:hover { background: #d9b56e; }
.share-stage { display: grid; place-items: center; padding: 24px; overflow: auto; }
.share-stage img, .share-stage video { max-width: 100%; max-height: calc(100vh - 140px); }
.share-stage iframe { width: 100%; height: calc(100vh - 110px); background: #fff; border: none; border-radius: 6px; }
.share-fallback { text-align: center; padding: 60px 24px; }
.share-fallback .ficon { display: inline-block; margin-bottom: 18px; }
.share-fallback p { color: #b5bdce; margin: 16px 0; }
.share-fallback .primary {
  display: inline-block; background: var(--gold); color: #1e1606;
  padding: 10px 22px; border-radius: 8px; font-weight: 600;
}

/* Upload (file-request) viewer */
.upload-stage {
  display: block;
  padding: 36px 24px 60px;
  background: linear-gradient(180deg, #0e1a33, #14213d 60%);
  min-height: calc(100vh - 80px);
}
.upload-card {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  color: var(--text);
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.upload-blurb { color: var(--text-soft); margin: 0 0 22px; font-size: 14.5px; line-height: 1.5; }
.upload-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.upload-meta input { width: 100%; }
.upload-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 44px 24px;
  border: 2px dashed var(--ink-3);
  border-radius: 12px;
  background: var(--bg-soft);
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, transform .05s;
}
.upload-drop:hover { background: var(--bg-hover); }
.upload-drop.over { border-color: var(--gold); background: #fdf6e3; transform: scale(1.005); }
.upload-drop input[type=file] { display: none; }
.upload-cta { font-weight: 600; color: var(--ink); }
.upload-sub { color: var(--text-muted); font-size: 13px; }
.upload-list { list-style: none; padding: 0; margin: 18px 0 0; }
.ulist-row {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
}
.ulist-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ulist-status { color: var(--text-muted); font-size: 12px; justify-self: end; }
.ulist-status.done { color: var(--success); font-weight: 600; }
.ulist-status.err  { color: var(--danger); font-weight: 600; }
.ulist-bar { grid-column: 1 / -1; height: 3px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.ulist-bar span { display: block; height: 100%; background: var(--ink-3); transition: width .2s; }

/* Folder listing in upload-stage + folder.php */
.folder-listing {
  max-width: 640px;
  margin: 24px auto 0;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 16px 20px;
  color: #d8dde7;
}
.folder-listing h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #b5bdce;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.folder-list { list-style: none; padding: 0; margin: 0; }
.folder-list-wide { max-width: 720px; margin: 0 auto; background: #fff; border-radius: 12px; color: var(--text); padding: 8px 0; }
.folder-row {
  display: grid;
  grid-template-columns: 28px 1fr 100px;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.folder-list-wide .folder-row { border-bottom: 1px solid var(--line-soft); padding: 10px 18px; }
.folder-row:last-child { border-bottom: none; }
.frow-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.frow-size { color: #b5bdce; font-size: 12px; text-align: right; }
.folder-list-wide .frow-size { color: var(--text-muted); }

@media (max-width: 640px) {
  .upload-meta { grid-template-columns: 1fr; }
  .upload-card { padding: 22px 18px; }
  .upload-drop { padding: 32px 16px; }
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 84vw; max-width: 320px;
    transform: translateX(-100%);
    transition: transform .2s;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 12px 14px; }
  .path-row { padding: 14px 14px 10px; }
  .items.as-list { padding: 0 6px 60px; }
  .items.as-list .items-head,
  .items.as-list .item {
    grid-template-columns: minmax(0,1fr) 90px 40px;
  }
  .items.as-list .col-size { display: none; }
  .items.as-grid { padding: 8px 12px 60px; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); }
  .upload-tray { right: 8px; bottom: 8px; }
  .share-link-controls { grid-template-columns: 1fr; }
  .share-add { grid-template-columns: 1fr; }
}
