/* Rechurjay — industrial palette: brushed-steel greys, gunmetal ink, blued-steel accent.
   Theme: follows the OS unless <html data-theme="light|dark"> (set from localStorage "sbs-theme"). */
:root {
  --bg: #e9ecef;
  --card: #fafbfc;
  --ink: #1f262c;
  --muted: #64707a;
  --line: #d6dce1;
  --accent: #3b6c8c;
  --accent-ink: #ffffff;
  --accent-soft: #dce7ef;
  --ok: #3f7a5e;
  --ok-soft: #ddede4;
  --warn: #9a6a1e;
  --warn-soft: #f2e7d2;
  --bad: #b04e3f;
  --bad-soft: #f4deda;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 6px 24px rgba(20, 30, 40, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121619; --card: #1a1f24; --ink: #e2e7eb; --muted: #9ba6af; --line: #2c343a;
    --accent: #7eaacb; --accent-ink: #0f1418; --accent-soft: #22323e;
    --ok: #7fb596; --ok-soft: #1e2d25; --warn: #d9a54e; --warn-soft: #33291a;
    --bad: #db8576; --bad-soft: #3a2420;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #121619; --card: #1a1f24; --ink: #e2e7eb; --muted: #9ba6af; --line: #2c343a;
    --accent: #7eaacb; --accent-ink: #0f1418; --accent-soft: #22323e;
    --ok: #7fb596; --ok-soft: #1e2d25; --warn: #d9a54e; --warn-soft: #33291a;
    --bad: #db8576; --bad-soft: #3a2420;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
}
* { box-sizing: border-box; }
input[type=checkbox] { accent-color: var(--accent); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .9em;
       background: var(--accent-soft); padding: .05em .35em; border-radius: 5px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; margin-top: 1.2em; }
.muted { color: var(--muted); } .small { font-size: .85em; }

.top { display: flex; align-items: center; justify-content: space-between;
       padding: 14px max(16px, 4vw); border-bottom: 1px solid var(--line); background: var(--card); }
.brand { display: flex; align-items: center; gap: .55em; font-weight: 700; font-size: 1.05rem;
         color: var(--ink); text-decoration: none; }
.mark { width: 22px; height: 22px; border-radius: 50%;
        background: radial-gradient(circle at 35% 30%, #f7f9fb, #aab5be 50%, #4f5b65);
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.top nav a { text-decoration: none; font-weight: 600; }
main { max-width: 1180px; margin: 0 auto; padding: 24px max(16px, 3vw) 8px; }
footer { max-width: 1180px; margin: 0 auto; padding: 16px max(16px, 3vw) 32px;
         color: var(--muted); font-size: .85em; }

.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.lede { color: var(--muted); margin-top: 0; }

form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92em; }
form small { font-weight: 400; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin: 16px 0; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
input[type=text], input:not([type]), input[type=number], select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: .92em; padding: 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.chip { flex-direction: row !important; align-items: center; gap: 6px !important; font-weight: 600;
        border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: var(--bg);
        cursor: pointer; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.chip .muted { font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
details.advanced { margin: 4px 0 16px; }
details.advanced summary { cursor: pointer; font-weight: 600; color: var(--muted); }

.drop { display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 26px 16px;
        text-align: center; cursor: pointer; background: var(--bg); position: relative;
        transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has { border-style: solid; border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

button, .button {
  font: inherit; font-weight: 650; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none;
  display: inline-block; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { filter: brightness(1.05); }
button:disabled { opacity: .6; cursor: progress; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }

.pill { display: inline-block; font-size: .75em; font-weight: 700; text-transform: uppercase;
        letter-spacing: .04em; padding: 2px 9px; border-radius: 999px;
        background: var(--accent-soft); color: var(--accent); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }
.pill.queued { background: var(--warn-soft); color: var(--warn); }
.pill.big { font-size: .85em; padding: 4px 12px; }
.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.hint { background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; }
ul.errors { padding-left: 1.2em; } ul.errors li { margin: .25em 0; overflow-wrap: anywhere; }

.joblist { list-style: none; padding: 0; margin: 0; }
.joblist li a { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
                padding: 10px 6px; border-bottom: 1px solid var(--line); color: var(--ink);
                text-decoration: none; border-radius: 8px; }
.joblist li a:hover { background: var(--bg); }
.joblist .jname { font-weight: 650; overflow-wrap: anywhere; }
.joblist .small { grid-column: 2; } .joblist .msg { color: var(--muted); overflow-wrap: anywhere; }

.jobhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.jobhead h1 { margin-bottom: .1em; overflow-wrap: anywhere; } .jobhead p { margin: 0; }
.working { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--accent-soft);
           border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; overflow-wrap: anywhere; }
ul.files { padding-left: 1.2em; columns: 2 260px; } ul.files li { overflow-wrap: anywhere; break-inside: avoid; }

.viewer { padding: 14px; }
.viewerhead { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 8px 10px; }
.viewer iframe { width: 100%; height: min(75vh, 720px); border: 0; border-radius: 10px; background: #e9e2d8; }
.checklist ul { margin: 0; padding-left: 1.2em; } .checklist li { margin: .3em 0; }

/* ---------------------------------------------------------------- sign in --- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.authbox { width: min(400px, 100%); margin: 0; }
.authbox .brand { margin-bottom: 18px; }
.authbox form { display: grid; gap: 14px; margin-bottom: 8px; }
input[type=password] { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; width: 100%; }

/* ------------------------------------------------------------------ drive --- */
body.drive { height: 100vh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.drive svg { width: 20px; height: 20px; flex: none; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dtop { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--bg); }
.dtop .brand { width: 224px; flex: none; }
.search { flex: 1; max-width: 720px; display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 16px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: var(--shadow); }
.search input { border: 0 !important; background: transparent !important; outline: none !important; padding: 7px 0 !important; }
.usermenu { margin-left: auto; position: relative; }
.usermenu summary { list-style: none; cursor: pointer; } .usermenu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .78em; }

.dshell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; }
.side { padding: 4px 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.newmenu { position: relative; margin: 4px 0 14px; }
.newbtn { list-style: none; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 650;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 22px 14px 16px;
  box-shadow: var(--shadow); }
.newbtn::-webkit-details-marker { display: none; }
.newbtn:hover { background: var(--accent-soft); }
.nav { display: flex; align-items: center; gap: 12px; padding: 7px 14px; border-radius: 999px; color: var(--ink);
  text-decoration: none; font-weight: 500; min-width: 0; }
.nav:hover { background: var(--line); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav.sub svg { width: 18px; height: 18px; color: var(--muted); }
.sidehead { font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 16px 14px 4px; }
.sidenote { padding: 0 14px; margin: 4px 0; }
.tag { font-size: .7em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; margin-left: auto; flex: none; }

.dmain { max-width: none; margin: 0; background: var(--card); border-radius: 18px 0 0 0; padding: 8px 24px 40px; overflow-y: auto;
  position: relative; border: 1px solid var(--line); border-right: 0; border-bottom: 0; }
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 6px;
  position: sticky; top: -8px; background: var(--card); z-index: 2; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.crumbs h1 { margin: 0; font-size: 1.35rem; font-weight: 500; padding: 4px 10px; }
.crumbs a { color: var(--muted); text-decoration: none; font-size: 1.15rem; padding: 4px 10px; border-radius: 999px; }
.crumbs a:hover { background: var(--bg); color: var(--ink); }
.crumbs .sep { color: var(--muted); }
.crumbs .tag { margin-left: 6px; }
.dtools { display: flex; align-items: center; gap: 8px; }
.faces { display: flex; } .faces .avatar { margin-left: -6px; border: 2px solid var(--card); }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 16px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--card); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.icon { padding: 6px; display: inline-grid; place-items: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg .btn { border: 0; border-radius: 0; padding: 6px 12px; }
.seg .btn.on { background: var(--accent-soft); color: var(--accent); }

.sechead { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.sechead h2 { font-size: .9rem; font-weight: 600; margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center;
  column-gap: 12px; padding: 10px 8px 10px 14px; border-radius: 12px; background: var(--bg); color: var(--ink);
  text-decoration: none; border: 1px solid transparent; min-width: 0; user-select: none; }
.tile:hover { background: var(--line); }
.tile .ic { grid-row: span 2; color: var(--muted); width: 24px; height: 24px; }
.tile .ic.sh { color: var(--accent); }
.tile .tname { font-weight: 600; } .tile .tmeta { font-size: .8em; color: var(--muted); grid-column: 2; }
.tile .more { grid-row: 1 / span 2; grid-column: 3; }
.more { border: 0; background: transparent; color: var(--muted); border-radius: 50%; width: 32px; height: 32px;
  display: grid; place-items: center; cursor: pointer; padding: 0; }
.more:hover { background: var(--card); color: var(--ink); }
.droptarget { outline: 2px solid var(--accent) !important; background: var(--accent-soft) !important; }

/* projects: grid of cards (default) or list rows */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas:
  "thumb thumb" "name more" "status status"; gap: 4px 6px; padding: 0 6px 12px 14px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink); text-decoration: none; overflow: hidden; }
.item:hover { box-shadow: var(--shadow); border-color: var(--muted); }
.item .thumb { grid-area: thumb; display: grid; place-items: center; height: 120px; margin: 0 -6px 6px -14px;
  background: linear-gradient(160deg, var(--accent-soft), var(--card) 70%); color: var(--accent); }
.item .thumb svg { width: 64px; height: 64px; opacity: .8; }
.item .iname { grid-area: name; display: flex; flex-direction: column; min-width: 0; padding-top: 4px; }
.item .more { grid-area: more; }
.item .istatus { grid-area: status; }
.item .iwho, .item .iwhen { display: none; }
.lhead { display: none; }
body[data-layout=list] .items { display: block; }
body[data-layout=list] .lhead, body[data-layout=list] .item {
  display: grid; grid-template-columns: minmax(0, 3fr) 150px minmax(0, 1fr) 110px 40px; grid-template-areas: none;
  align-items: center; gap: 12px; padding: 6px 4px 6px 12px; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent; box-shadow: none; }
body[data-layout=list] .lhead { font-size: .8em; color: var(--muted); font-weight: 600; padding-top: 0; }
body[data-layout=list] .item:hover { background: var(--bg); }
body[data-layout=list] .item .thumb { display: none; }
body[data-layout=list] .item > * { grid-area: auto; }
body[data-layout=list] .item .iwho, body[data-layout=list] .item .iwhen { display: block; }
body[data-layout=list] .item .iname { padding: 0; }

.empty { display: grid; justify-items: center; text-align: center; color: var(--muted); padding: 60px 16px;
  border-radius: 16px; }
.empty svg { width: 72px; height: 72px; color: var(--accent); opacity: .6; }
.empty.dropzone { border: 2px dashed var(--line); }
.dropveil { position: fixed; inset: 0; display: none; place-items: center; z-index: 40;
  background: color-mix(in srgb, var(--accent) 18%, transparent); pointer-events: none; }
.dropveil.on { display: grid; }
.dropveil div { display: flex; align-items: center; gap: 12px; background: var(--accent); color: var(--accent-ink);
  padding: 14px 22px; border-radius: 999px; box-shadow: var(--shadow); }

/* menus, dialogs, toasts */
.menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 230px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 6px 0;
  display: flex; flex-direction: column; }
.menu.right { left: auto; right: 0; }
.menu.ctx { position: fixed; top: 0; left: 0; }
.menu[hidden] { display: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.menu .mh { padding: 6px 16px 8px; font-size: .9em; color: var(--muted); }
.mi { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; text-align: left;
  font: inherit; color: var(--ink); padding: 8px 16px; cursor: pointer; border-radius: 0; font-weight: 500; }
.mi:hover { background: var(--bg); }
a.mi { text-decoration: none; }
.mi.danger { color: var(--bad); }
.mi svg { color: var(--muted); }
.dlg { border: 0; border-radius: 18px; padding: 22px 24px; width: min(420px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dlg.wide { width: min(560px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(12, 17, 22, .45); }
.dlg h2 { font-weight: 500; font-size: 1.3rem; overflow-wrap: anywhere; }
.dlg input, .dlg select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; }
.dlg #prompt-input { width: 100%; }
.dlg .fld { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; font-size: .92rem; }
.dlg .fld input { width: 10em; }
.dbtns { display: flex; flex-direction: row-reverse; gap: 8px; margin-top: 18px; }
.shareadd { display: flex; gap: 8px; } .shareadd input { flex: 1; min-width: 0; }
.members { list-style: none; padding: 0; margin: 4px 0 12px; max-height: 300px; overflow-y: auto; }
.members li { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.members li .ell { flex: 1; }
.movetree { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px 0; }
.mrow { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; font: inherit;
  color: var(--ink); text-align: left; padding: 7px 10px; cursor: pointer; }
.mrow:hover { background: var(--bg); } .mrow.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mrow svg { color: var(--muted); width: 18px; height: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--card); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow);
  display: grid; gap: 6px; overflow-wrap: anywhere; }
.toast.bad { background: var(--bad); }
.toast .bar { height: 4px; background: rgba(255, 255, 255, .25); border-radius: 2px; overflow: hidden; }
.toast .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

@media (max-width: 760px) {
  .dshell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .side { flex-direction: row; overflow-x: auto; padding: 0 16px 10px; align-items: center; gap: 4px; }
  .side > * { flex: none; }
  .newmenu .menu { position: fixed; top: 116px; left: 16px; }
  .side .sidehead, .side .sidenote, .side .nav.sub { display: none; }
  .newmenu { margin: 0; } .newbtn { padding: 8px 14px; box-shadow: none; }
  .nav { white-space: nowrap; padding: 6px 12px; }
  .dtop .brand { width: auto; } .dtop .brand .muted { display: none; }
  .dmain { border-radius: 0; padding: 4px 16px 32px; border-left: 0; }
  .items, .tiles { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  body[data-layout=list] .lhead { display: none; }
  body[data-layout=list] .item { grid-template-columns: minmax(0, 1fr) auto 40px; }
  body[data-layout=list] .item .iwho, body[data-layout=list] .item .iwhen { display: none; }
}

/* theme picker in the user menu */
.themepick { display: flex; gap: 4px; padding: 4px 12px 8px; }
.themepick button { flex: 1; font: inherit; font-size: .85em; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); border-radius: 8px; padding: 5px 8px; cursor: pointer; }
.themepick button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }
