/* Local Cloud — dark, phone-friendly file manager */
:root {
  --bg: #0e1116;
  --panel: #151a22;
  --panel-2: #1a212c;
  --panel-3: #202836;
  --line: #242c3a;
  --line-soft: #1d2431;
  --text: #e8ebf1;
  --muted: #8f9cb3;
  --accent: #4f8cff;
  --accent-2: #3f7ae8;
  --ok: #38d39f;
  --warn: #ffb648;
  --danger: #ff5f6d;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 34px rgba(0, 0, 0, .38);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.screen { min-height: 100vh; }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 550;
  transition: background .13s ease, border-color .13s ease, transform .05s ease; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { border-color: #582630; color: #ff97a0; background: #2a1720; }
.btn.danger:hover { background: #381c26; }
.btn.full { width: 100%; justify-content: center; display: block; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.link:hover { text-decoration: underline; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--panel-3); }

input[type=text], input[type=tel], input[type=search], input[type=password], input[type=number], select, textarea {
  width: 100%; background: #0f141c; border: 1px solid var(--line); color: var(--text);
  padding: 11px 12px; border-radius: 9px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, .16); }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 550; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; box-shadow: var(--shadow);
}
.brand { display: flex; gap: 13px; align-items: center; margin-bottom: 22px; }
.brand-mark {
  width: 45px; height: 45px; border-radius: 13px; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(145deg, var(--accent), #7b5cff); color: #fff; flex: 0 0 auto;
}
.brand-mark.small { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
.step { margin-top: 6px; }
.step .btn { margin-top: 12px; }
#code { font-family: var(--mono); font-size: 24px; letter-spacing: .35em; text-align: center; padding: 13px; }
.msg { margin-top: 16px; padding: 11px 13px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--line); background: var(--panel-2); }
.msg.ok { border-color: #1e5442; background: #10241e; color: #a8f0d3; }
.msg.warn { border-color: #5c4620; background: #241d10; color: #ffdca1; }
.msg.err { border-color: #5b2730; background: #241318; color: #ffb3ba; }
.foot { margin-top: 20px; text-align: center; }
code { font-family: var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }

/* ---------------------------------------------------------------- app shell */
#app-screen { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-head { display: flex; gap: 11px; align-items: center; padding: 4px 6px 12px; border-bottom: 1px solid var(--line-soft); }
.side-head strong { display: block; font-size: 15px; }
.side-head .small { display: block; margin-top: 1px; }
.drives { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; }
.drive {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  cursor: pointer; color: var(--text); border: 1px solid transparent; font-size: 14px;
}
.drive:hover { background: var(--panel-2); }
.drive.active { background: var(--panel-3); border-color: var(--line); }
.drive .dot { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); flex: 0 0 auto; }
.drive.readonly .dot { background: var(--muted); }
.drive .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive .tag { font-size: 11px; color: var(--muted); }
.side-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.side-link {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--muted);
  padding: 8px 11px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px;
}
.side-link:hover { background: var(--panel-2); color: var(--text); }
.side-link.danger:hover { color: #ff97a0; }

.main { min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar {
  display: flex; gap: 12px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 22, .9); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; font-size: 14px; }
.crumb { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 7px; border-radius: 7px; font: inherit; }
.crumb:hover { background: var(--panel-2); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb-sep { color: #48536a; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.search input { width: 190px; padding: 9px 11px; }
.statusbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 20px 0; font-size: 12.5px;
}
.listing { padding: 14px 20px 90px; }

/* -------------------------------------------------------------- file listing */
table.files { width: 100%; border-collapse: collapse; font-size: 14px; }
table.files th {
  text-align: left; color: var(--muted); font-weight: 550; font-size: 12.5px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap;
}
table.files th.right, table.files td.right { text-align: right; }
table.files td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.files tbody tr:hover { background: var(--panel); }
table.files tbody tr.selected { background: var(--panel-2); }
.fname { display: flex; align-items: center; gap: 11px; min-width: 0; }
.fname .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname .label.linkish { cursor: pointer; }
.fname .label.linkish:hover { color: var(--accent); text-decoration: underline; }
.rowmenu { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 15px; }
.rowmenu:hover { background: var(--panel-3); color: var(--text); }
.icon { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; }
.icon svg { width: 22px; height: 22px; }
.c-folder { color: #6ea8ff; } .c-image { color: #7ad3a0; } .c-video { color: #c79bff; }
.c-audio { color: #ffb648; } .c-pdf { color: #ff7f7f; } .c-text { color: #9fb2cc; }
.c-archive { color: #d8a76a; } .c-document { color: #6fd0e0; } .c-file { color: #8f9cb3; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px;
  cursor: pointer; position: relative; overflow: hidden; min-height: 122px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.card:hover { border-color: #38445a; background: var(--panel-2); }
.card .thumb { height: 62px; border-radius: 8px; background: var(--panel-3); display: grid; place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.card .meta { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.banner { margin: 0 0 14px; padding: 10px 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; font-size: 13.5px; display: flex; justify-content: space-between; gap: 12px; }

/* ---------------------------------------------------------------- uploads */
.uploads {
  position: fixed; right: 20px; bottom: 20px; width: 340px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px; z-index: 60; max-height: 62vh; overflow-y: auto;
}
.uploads h4 { font-size: 13px; margin-bottom: 9px; display: flex; justify-content: space-between; }
.up-item { margin-bottom: 11px; font-size: 13px; }
.up-item .nm { display: flex; justify-content: space-between; gap: 8px; }
.up-item .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 5px; border-radius: 3px; background: var(--panel-3); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s ease; }
.bar.done > i { background: var(--ok); }
.bar.fail > i { background: var(--danger); }
.drop-hint {
  position: fixed; inset: 0; background: rgba(14, 17, 22, .82); z-index: 80; display: grid; place-items: center;
  font-size: 20px; font-weight: 600; border: 2px dashed var(--accent); pointer-events: none;
}

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; background: rgba(6, 9, 13, .68); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 480px;
  padding: 22px; box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto;
}
.modal-box h3 { margin-bottom: 6px; }
.modal-box .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-box.wide { max-width: 720px; }
.preview-body { background: #0a0d12; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: grid; place-items: center; min-height: 240px; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 68vh; display: block; }
.preview-body audio { width: 100%; padding: 22px; }
.preview-body iframe { width: 100%; height: 68vh; border: 0; background: #fff; }
.preview-body pre { margin: 0; padding: 16px; width: 100%; max-height: 68vh; overflow: auto; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
#editor {
  font-family: var(--mono); font-size: 13px; line-height: 1.55; min-height: 46vh; resize: vertical;
  white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 4;
}
.editor-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pill.save { color: #a8f0d3; border-color: #1e5442; background: #10241e; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; }

/* ------------------------------------------------------------- context menu */
.ctxmenu {
  position: fixed; z-index: 100; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 186px;
}
.ctxmenu button {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 8px 11px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13.5px;
}
.ctxmenu button:hover { background: var(--panel-3); }
.ctxmenu button.danger { color: #ff97a0; }
.ctxmenu .sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 15px;
  border-radius: 10px; box-shadow: var(--shadow); font-size: 13.5px; max-width: min(560px, 92vw);
}
.toast.ok { border-color: #1e5442; } .toast.err { border-color: #5b2730; } .toast.warn { border-color: #5c4620; }

/* ---------------------------------------------------------------- responsive */
.only-mobile { display: none; }
@media (max-width: 900px) {
  #app-screen { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 70; transform: translateX(-102%);
    transition: transform .18s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .topbar { flex-wrap: wrap; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; order: 3; }
  .cross-hide { display: none; }
  .listing { padding: 12px 12px 90px; }
  table.files th.hide-mobile, table.files td.hide-mobile { display: none; }
}

/* ------------------------------------------------------- Google sign-in button */
.btn.google {
  background: #fff; border-color: #d7dae0; color: #1f2328; font-weight: 550;
  display: flex; align-items: center; justify-content: center; gap: 9px;
}
.btn.google:hover { background: #f4f6f9; }
.g-mark {
  width: 17px; height: 17px; border-radius: 50%; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%,
  #34a853 0 75%, #4285f4 0); color: #fff; font: 700 12px/17px system-ui, sans-serif;
  text-align: center; flex: 0 0 auto;
}
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; height: 1px; background: var(--line); flex: 1; }

/* --------------------------------------------- "continue where you left off" box */
.welcome {
  margin: 12px 14px 0; padding: 14px 16px 12px; border: 1px solid var(--line);
  border-radius: 13px; background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.welcome-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.welcome-head strong { font-size: 15px; }
.welcome p { margin: 4px 0 10px; }
.welcome-list { display: flex; flex-wrap: wrap; gap: 8px; }
.welcome-item {
  display: flex; align-items: baseline; gap: 8px; max-width: 340px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-3); color: inherit; font: inherit;
  padding: 8px 11px; border-radius: 10px; text-align: left;
}
.welcome-item:hover { border-color: var(--accent); background: var(--panel-2); }
.w-verb { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.w-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-when { flex: 0 0 auto; }

