:root {
  --bg: #f4f6fa; --card: #fff; --text: #1a1f2b; --muted: #6b7385; --line: #e3e7ef;
  --primary: #0b5fff; --primary-d: #0a4fd4; --danger: #d92d20; --ok: #12a150; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }
.logo { width: 28px; height: 28px; vertical-align: middle; }
h1 { font-size: 20px; display: flex; gap: 10px; align-items: center; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.narrow { max-width: 440px; margin: 8vh auto; }
label { display: block; margin: 12px 0; font-size: 14px; }
input:not([type=checkbox]):not([type=file]), textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
button, .button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: #f0f3f9; }
.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-d); }
.danger { color: var(--danger); border-color: #f3c6c2; }
.ghost { border: none; background: transparent; }
form .primary, #setup-step1 .primary, #btn-setup-finish { width: 100%; justify-content: center; padding: 12px; margin-top: 8px; }
.msg { min-height: 1.4em; color: var(--danger); font-size: 14px; }
.msg.ok { color: var(--ok); }
.secret { font-family: ui-monospace, Consolas, monospace; background: #f0f3f9; padding: 10px; border-radius: 8px; word-break: break-all; text-align: center; letter-spacing: 1px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.fname { direction: ltr; unicode-bidi: isolate; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.crumbs a { color: var(--primary); text-decoration: none; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
.crumbs a:hover { background: #e8efff; }
.drop { margin: 0 20px 12px; border: 2px dashed #c6cfdf; border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--primary); background: #eef3ff; color: var(--primary); }
.progress { position: relative; margin: 0 20px 12px; height: 26px; background: #e8ecf3; border-radius: 8px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .15s; }
#progress-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; mix-blend-mode: difference; }
.selbar { margin: 0 20px 8px; display: flex; gap: 12px; align-items: center; }

table.files { width: calc(100% - 40px); margin: 0 20px 40px; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.files th, .files td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.files th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfd; }
.files tr:hover td { background: #f8faff; }
.files .name { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-direction: row-reverse; justify-content: flex-end; word-break: break-all; }
.files .name:hover { color: var(--primary); }
.c-check { width: 36px; } .c-size { width: 100px; } .c-date { width: 160px; } .c-act { width: 1%; white-space: nowrap; }
.files td.c-size, .files td.c-date { color: var(--muted); font-size: 13px; text-align: left; }
.row-actions { display: flex; gap: 4px; }
.row-actions button { padding: 4px 8px; font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }

.modal { position: fixed; inset: 0; background: rgba(15,20,30,.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--radius); width: min(980px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; word-break: break-all; }
#modal-body { padding: 16px 18px; overflow: auto; }
.editor { width: 100%; height: 62vh; font-family: ui-monospace, Consolas, monospace; font-size: 13px; direction: ltr; text-align: left; white-space: pre; tab-size: 2; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.list .files-mini { direction: ltr; text-align: left; font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; margin: 6px 0; }
.files-mini div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.log-line { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.log-line .t { color: var(--muted); direction: ltr; }
.log-line .d { direction: ltr; font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1a1f2b; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 30; font-size: 14px; }
.toast.err { background: var(--danger); }

@media (max-width: 700px) {
  .c-date, .files td.c-date { display: none; }
  .toolbar { padding: 12px; } .drop, .progress, .selbar { margin-left: 12px; margin-right: 12px; }
  table.files { width: calc(100% - 24px); margin: 0 12px 30px; }
  .c-size, .files td.c-size { display: none; }
  .files td.c-act { white-space: normal; width: 120px; }
  .row-actions { flex-wrap: wrap; justify-content: flex-start; }
  .files .name { word-break: break-word; }
  .topbar { padding: 10px 12px; gap: 8px; } .topbar nav button { padding: 6px 8px; font-size: 13px; }
}
