:root {
  --bg: #f7f8fa; --surface: #fff; --text: #1b1f24; --muted: #6b7280; --line: #e3e6ea;
  --primary: #0069ff; --primary-dark: #0052cc; --danger: #d93025; --warn: #b45309; --row-hover: #f2f6ff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.warn { color: var(--warn); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a.active { color: var(--text); font-weight: 600; }
.brand { font-weight: 700; color: var(--text); }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.bucket-head h1 { margin: 0 0 4px; font-size: 28px; }
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.search { flex: 1; min-width: 200px; max-width: 520px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.btn { border: 1px solid var(--primary); background: var(--surface); color: var(--primary); border-radius: 999px; padding: 7px 16px; font: inherit; cursor: pointer; }
.btn:hover { background: var(--row-hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.link { border: 0; color: var(--muted); padding: 0; }
.btn.icon { border: 0; border-radius: 6px; padding: 2px 10px; font-size: 18px; color: var(--muted); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.table-wrap.dragging { outline: 2px dashed var(--primary); outline-offset: -6px; }
table.files { width: 100%; border-collapse: collapse; }
table.files th { text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.files td { padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.files tr:last-child td { border-bottom: 0; }
table.files tbody tr:hover { background: var(--row-hover); }
td.check, th.check { width: 44px; }
td.more { width: 56px; text-align: right; }
.name { white-space: normal; overflow-wrap: anywhere; }
.empty { padding: 32px; text-align: center; color: var(--muted); margin: 0; }
.pager { display: flex; justify-content: center; gap: 12px; align-items: center; margin-top: 16px; }
.menu { position: absolute; z-index: 20; width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; }
.menu button:hover { background: var(--row-hover); }
.menu button.danger { color: var(--danger); }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { position: relative; background: var(--surface); border-radius: 10px; padding: 20px; max-width: min(960px, 100%); max-height: 100%; overflow: auto; }
.modal-box h2 { margin: 0 32px 12px 0; font-size: 16px; overflow-wrap: anywhere; }
.modal-box video, .modal-box img { max-width: 100%; max-height: 75vh; display: block; }
.modal-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.upload-panel { margin-bottom: 16px; display: grid; gap: 8px; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) 200px minmax(0, 180px); gap: 12px; align-items: center; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item progress { width: 100%; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1b1f24; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 40; max-width: calc(100% - 32px); }
.toast.error { background: var(--danger); }
.login { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login h1 { margin: 0; font-size: 22px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input:not([type=checkbox]) { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.inline-form label { flex: 1; min-width: 200px; }
.notice { display: grid; gap: 8px; margin-bottom: 16px; border-color: var(--warn); }
.notice code { padding: 8px; background: var(--bg); border-radius: 6px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .upload-item { grid-template-columns: 1fr; gap: 4px; }
  table.files td, table.files th { padding: 10px 8px; }
}
