/* JIMTEX PRO DETAILS - team web platform.
   A copy of the desktop app, measure for measure: the same black
   neumorphism (neo.py), the same glass panels, the same splash and login,
   the same preview. Only the arrangement changes with the screen: the
   desktop's floating panels on a wide screen, one column on a phone. */

:root {
  --bg: #0c0c10;
  --surface-top: #1a1a22;
  --surface-bottom: #0e0e13;
  --well-top: #08080b;
  --well-bottom: #101015;
  --text: #e9eaf1;
  --text-dim: #9095a6;
  --text-mute: #5f6377;
  --accent: #8a6bf2;
  --accent-hi: #ac93ff;
  --accent-deep: #5a3fc0;
  --danger: #e46a83;
  --success: #57d3a2;
  --warning: #e6b871;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  /* neo.surface_pixmap: black blurred down-right, white 24/255 up-left */
  --raised: 4px 4px 12px #000, -4px -4px 12px rgba(255, 255, 255, .094);
  --raised-soft: 3px 3px 9px #000, -3px -3px 9px rgba(255, 255, 255, .094);
  --inset: inset 4px 4px 9px #000, inset -4px -4px 9px rgba(255, 255, 255, .094);
  --rail-w: 124px;
  --panel-w: 358px;
  --float: 25px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13.3px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }
button, input, select { font-family: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent-deep); color: #fff; }

/* ===================================================================== */
/* opening: splash.StartupSplash, then login_dialog.LoginDialog           */
/* ===================================================================== */

.stage-full { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); overflow: auto; }
.splash {
  width: min(880px, 100%); padding: 42px clamp(18px, 6vw, 52px);
  border-radius: 26px; border: 1px solid #2a2338; background: rgba(10, 10, 14, .98);
  display: flex; flex-direction: column; gap: 7px; opacity: 0;
}
.splash.play { animation: splashIn .65s cubic-bezier(.33, 1, .68, 1) forwards; }
.splash.gone { animation: splashOut .3s ease-in forwards; }
@keyframes splashIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes splashOut { from { opacity: 1; } to { opacity: 0; } }
.splash canvas { display: block; width: 100%; height: clamp(150px, 26vw, 190px); }
.splash-sub { text-align: center; color: var(--text-dim); font-size: 13.3px; font-weight: 800; letter-spacing: 4px; }
.splash-status { text-align: center; color: var(--accent-hi); font-size: 12px; font-weight: 700; letter-spacing: 2px; padding-top: 12px; }
@media (max-width: 560px) {
  .splash-sub { font-size: 10px; letter-spacing: 2.5px; }
  .splash-status { font-size: 10px; letter-spacing: 1.5px; }
}

.dialog {
  width: min(520px, 100%); padding: 28px 36px 30px; border-radius: 16px;
  background: var(--bg); border: 1px solid #1b1b23; box-shadow: 0 24px 70px rgba(0, 0, 0, .7);
  display: flex; flex-direction: column; gap: 14px;
  animation: dialogIn .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes dialogIn { from { transform: translateY(10px); } to { transform: none; } }
.dialog .brand { text-align: center; color: #f4f4f8; font-size: 28px; font-weight: 900; letter-spacing: 2px; line-height: 1.15; }
.dialog .subtitle { text-align: center; color: var(--text-mute); font-size: 10.7px; font-weight: 800; letter-spacing: 4px; margin-top: -10px; margin-bottom: 8px; }
.dialog .title { color: #f4f4f8; font-size: 28px; font-weight: 900; letter-spacing: 2px; line-height: 1.15; }
.dialog .help { color: var(--text-dim); padding-bottom: 6px; line-height: 1.45; margin: -6px 0 0; }
.dialog .flabel { color: var(--text-mute); font-size: 10.7px; font-weight: 800; letter-spacing: 2px; margin: 0 0 -8px; }
.dialog .row2 { display: grid; grid-template-columns: 170px 1fr; gap: 10px 12px; align-items: center; }
.dialog .row2 label { color: var(--text-dim); }
.line {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px; outline: none;
  background: linear-gradient(135deg, #08080b, #131319);
  border: 1px solid #202029; border-top-color: #040406; border-left-color: #040406;
  color: var(--text); font-size: 13.3px;
}
.line:focus { border: 1px solid var(--accent); }
.line[readonly] { color: var(--text-dim); }
.line::placeholder { color: #4b4e5e; }
.check { display: flex; align-items: center; gap: 9px; color: var(--text-dim); cursor: pointer; user-select: none; width: fit-content; position: relative; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check i { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 6px; border: 1px solid #26262f; background: #0a0a0d; }
.check input:checked + i { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); border-color: var(--accent-hi); }
.check input:focus-visible + i { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.feedback { color: var(--danger); min-height: 34px; margin: 0; line-height: 1.4; }
.feedback.ok { color: var(--success); }
.dbtn {
  min-height: 44px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid #23232d; background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom));
  color: var(--text-dim); font-size: 13.3px; font-weight: 800; letter-spacing: 1px;
}
.dbtn:hover:not([disabled]) { color: var(--accent-hi); border-color: var(--accent); }
.dbtn:active:not([disabled]) { background: linear-gradient(135deg, #08080b, #131319); }
.dbtn.primary { background: linear-gradient(135deg, #2a1f52, #1a1330); border-color: var(--accent); color: #d9ccff; font-size: 14px; }
.dbtn.secondary { background: transparent; }
.dbtn[disabled] { color: var(--text-mute); background: #101014; border-color: #1b1b23; cursor: default; }
.dbtns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.dbtns .dbtn { min-width: 110px; }

/* ===================================================================== */
/* main window                                                            */
/* ===================================================================== */

.app { position: fixed; inset: 0; background: var(--bg); overflow: hidden; }

/* neo.NeoPanel, pad 9: the preview card fills the window */
.card {
  position: absolute; inset: 9px; border-radius: 18px;
  background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom));
  box-shadow: var(--raised);
  display: flex; flex-direction: column; gap: 8px; padding: 15px 13px 9px;
}
/* neo.NeoWell around the preview */
.viewwell {
  flex: 1; min-height: 0; padding: 2px; position: relative; border-radius: 14px;
  background: linear-gradient(135deg, var(--well-top), var(--well-bottom)); box-shadow: var(--inset);
}
#view { display: block; width: 100%; height: 100%; border-radius: 12px; touch-action: none; cursor: grab; }
#view.panning { cursor: grabbing; }
#view.splitting { cursor: ew-resize; }
.zoomrow { display: flex; align-items: center; gap: 8px; padding: 0 4px; min-height: 42px; }
.zoomrow input[type=range] { flex: 1; min-width: 60px; }
.zoomlabel { color: var(--accent-hi); font-size: 12px; font-weight: 800; min-width: 44px; }
.movehint { color: var(--text-mute); font-size: 10.7px; letter-spacing: 2px; white-space: nowrap; }
.zoomrow .fit { width: 118px; flex: 0 0 118px; }

/* header floating over the picture, between the two panels */
.headbar {
  position: absolute; z-index: 5; top: 9px; height: 52px;
  left: calc(var(--float) + var(--rail-w) + 12px); right: calc(var(--float) + var(--panel-w) + 12px);
  display: flex; align-items: center; gap: 2px; padding: 0 10px; pointer-events: none;
}
.headbar > * { pointer-events: auto; }
.headbar .titles { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.apptitle { color: #f4f4f8; font-size: 29.3px; font-weight: 900; letter-spacing: 2px; line-height: 1.05; white-space: nowrap; }
.appsub { color: var(--text-mute); font-size: 10.7px; font-weight: 700; letter-spacing: 4px; white-space: nowrap; }
.headbar .grow { flex: 1; }
.version { color: var(--accent-hi); font-size: 10.7px; font-weight: 800; letter-spacing: 1px; padding: 0 4px; }

/* neo.GlassPanel: frost of the picture behind, tint, sheen, hairline */
.glass {
  position: absolute; z-index: 6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .133) 0%, rgba(255, 255, 255, .02) 50%, rgba(0, 0, 0, .118) 100%),
    rgba(14, 13, 22, .77);
  -webkit-backdrop-filter: blur(22px) saturate(115%); backdrop-filter: blur(22px) saturate(115%);
  border: 1px solid rgba(255, 255, 255, .157);
}
.rail {
  left: var(--float); top: var(--float); bottom: calc(var(--float) + 78px); width: var(--rail-w);
  border-radius: 18px; padding: 13px; display: flex; flex-direction: column; gap: 6px;
}
.export {
  right: var(--float); top: var(--float); width: var(--panel-w); max-height: calc(100% - 2 * var(--float) - 78px);
  border-radius: 20px; padding: 19px 19px 16px; display: flex; flex-direction: column; gap: 5px;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #262731 transparent;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .141) 0%, rgba(255, 255, 255, .02) 50%, rgba(0, 0, 0, .118) 100%),
    rgba(14, 13, 22, .77);
}
.export > .txt { padding: 0; }
.export::-webkit-scrollbar, .list::-webkit-scrollbar { width: 9px; height: 9px; }
.export::-webkit-scrollbar-thumb, .list::-webkit-scrollbar-thumb { background: rgba(38, 39, 49, .5); border-radius: 4px; }
.export::-webkit-scrollbar-thumb:hover, .list::-webkit-scrollbar-thumb:hover { background: var(--accent-deep); }

.sectiontitle { color: #f0f0f6; font-size: 14px; font-weight: 800; letter-spacing: 2px; padding-top: 7px; }
.infotext { color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.fieldlabel { color: var(--text-mute); font-size: 10.7px; font-weight: 800; letter-spacing: 2px; }
.pathlabel { color: var(--text-mute); font-size: 11.3px; line-height: 1.4; word-break: break-word; }
.statustext { color: var(--text-dim); font-size: 12px; line-height: 1.45; min-height: 17px; }
.strengthrow { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.strengthval { color: var(--accent-hi); font-size: 12px; font-weight: 800; min-width: 44px; text-align: right; }
.export input[type=range] { width: 100%; margin: 0; }
.gap4 { height: 4px; flex: 0 0 4px; }
.gap6 { height: 6px; flex: 0 0 6px; }
.gap8 { height: 8px; flex: 0 0 8px; }
.stretch { flex: 1 1 0; min-height: 0; }

/* neo.NeoButton: shape inset 7 px (pad) from the widget, radius 13 */
.nb {
  display: block; width: calc(100% - 14px); margin: 7px; padding: 0 10px; border-radius: 13px; cursor: pointer;
  height: 28px; flex: 0 0 auto;
  border: 0; background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom)); box-shadow: var(--raised);
  color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb:hover:not([disabled]) { color: var(--accent-hi); }
.nb:active:not([disabled]) { box-shadow: var(--inset); }
.nb[disabled] { background: linear-gradient(135deg, #141418, #0d0d11); color: var(--text-mute); cursor: default; }
.nb.primary { background: linear-gradient(135deg, #2a1f52, #1a1330); color: #d9ccff; box-shadow: var(--raised), inset 0 0 0 1.3px var(--accent); }
.nb.primary:hover:not([disabled]) { color: #d9ccff; box-shadow: var(--raised), inset 0 0 0 1.3px var(--accent-hi); }
.nb.primary:active:not([disabled]) { box-shadow: var(--inset), inset 0 0 0 1.3px var(--accent-hi); }
.nb.primary[disabled] { background: linear-gradient(135deg, #141418, #0d0d11); color: var(--text-mute); box-shadow: var(--raised); }
.nb.danger { background: linear-gradient(135deg, #2c161d, #1a1014); color: #f0a3b3; }
.nb.danger:hover:not([disabled]) { color: var(--danger); }
.nb.danger[disabled] { background: linear-gradient(135deg, #141418, #0d0d11); color: var(--text-mute); }
.nb.checked { box-shadow: var(--inset); color: var(--accent-hi); }
.nb.h34 { height: 20px; } .nb.h36 { height: 22px; } .nb.h38 { height: 24px; } .nb.h40 { height: 26px; }
.nb.h42 { height: 28px; } .nb.h50 { height: 36px; } .nb.h52 { height: 38px; }
.nb.f8 { font-size: 10.7px; } .nb.f85 { font-size: 11.3px; } .nb.f10 { font-size: 13.3px; } .nb.f15 { font-size: 20px; }
.ghost {
  height: 26px; margin: 7px 2px; padding: 0 10px; border: 0; border-radius: 13px; background: transparent; cursor: pointer;
  color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .8px; white-space: nowrap;
}
.ghost:hover { color: var(--accent-hi); background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom)); box-shadow: var(--raised-soft); }
.ghost:active { box-shadow: inset 3px 3px 7px #000, inset -3px -3px 7px rgba(255, 255, 255, .094); }

/* neo.NeoIconButton */
.icon {
  width: 24px; height: 24px; flex: 0 0 24px; margin: 5px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 0; background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom)); box-shadow: 3px 3px 8px #000, -3px -3px 8px rgba(255, 255, 255, .094);
  color: var(--text-dim); font-size: 16px; font-weight: 700; line-height: 24px;
}
.icon:hover { background: linear-gradient(135deg, #232430, #14141b); color: var(--accent-hi); }
.icon:active { box-shadow: inset 3px 3px 6px #000, inset -3px -3px 6px rgba(255, 255, 255, .094); }

/* the combo box and the name field sit in neo wells */
.wellfield { border-radius: 14px; background: linear-gradient(135deg, var(--well-top), var(--well-bottom)); box-shadow: var(--inset); margin: 0 6px; }
.wellfield select, .wellfield input {
  width: 100%; min-height: 40px; padding: 0 14px; border: 0; outline: none; background: transparent;
  color: var(--text); font-size: 13.3px; font-weight: 700;
}
.wellfield select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 21px) 18px, calc(100% - 16px) 18px; background-size: 5px 6px; background-repeat: no-repeat; }
.wellfield select:hover { background-image: linear-gradient(45deg, transparent 50%, var(--accent-hi) 50%), linear-gradient(135deg, var(--accent-hi) 50%, transparent 50%); }
.wellfield select option { background: #131319; color: var(--text); }
.wellfield input::placeholder { color: #4b4e5e; font-weight: 500; }

/* QSlider from neo.CONTROL_QSS */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; --fill: 50%; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; border: 1px solid #1c1d26;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-hi)) 0 0 / var(--fill) 100% no-repeat, #08080b;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: linear-gradient(135deg, #2a2b38, #101015); border: 1px solid var(--accent);
}
input[type=range]:hover::-webkit-slider-thumb { border-color: var(--accent-hi); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; border: 1px solid #1c1d26; background: #08080b; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-deep), var(--accent-hi)); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, #2a2b38, #101015); border: 1px solid var(--accent); }

/* --- the rail: queue_tile.QueueTile, compact ---------------------------- */
.railwell {
  flex: 1; min-height: 0; margin: 0 6px; padding: 1px; border-radius: 14px;
  background: linear-gradient(135deg, var(--well-top), var(--well-bottom)); box-shadow: var(--inset);
  display: flex; flex-direction: column;
}
.list {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; scrollbar-color: #262731 transparent;
}
.tile { position: relative; flex: 0 0 104px; height: 104px; display: flex; align-items: center; justify-content: center; cursor: pointer; outline: none; }
.tile .sq {
  position: relative; width: 70px; height: 70px; border-radius: 13px;
  background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom));
  box-shadow: 3px 3px 9px #000, -3px -3px 9px rgba(255, 255, 255, .094);
}
.tile.sel .sq { background: linear-gradient(135deg, #1d1d26, #111117); box-shadow: 3px 3px 9px #000, -3px -3px 9px rgba(255, 255, 255, .094), 0 0 0 1.4px var(--accent); }
.tile .sq img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; pointer-events: none; }
.tile .dot { position: absolute; left: -2px; top: -2px; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #0a0a0e; background: var(--text-mute); }
.tile.queued .dot, .tile.running .dot { background: var(--accent-hi); }
.tile.done .dot { background: var(--success); }
.tile.failed .dot { background: var(--danger); }
.tile .x {
  position: absolute; right: -8px; top: -8px; width: 18px; height: 18px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 0; background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom)); box-shadow: 2px 2px 6px #000, -2px -2px 6px rgba(255, 255, 255, .094);
  color: var(--text-dim); font-size: 10px; font-weight: 700; line-height: 18px;
}
.tile .x:hover { background: linear-gradient(135deg, #232430, #14141b); color: var(--danger); }
.tile:focus-visible .sq { box-shadow: 0 0 0 2px var(--accent-hi); }
.tile.uploading .sq { opacity: .6; }
.tile .prog { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .7); overflow: hidden; }
.tile .prog i { display: block; height: 100%; width: 0; background: var(--accent-hi); }

/* --- overlays ------------------------------------------------------------ */
.dropoverlay {
  position: fixed; inset: 18px; z-index: 40; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px;
  background: rgba(12, 12, 16, .886); border: 2px dashed var(--accent); border-radius: 22px;
  color: var(--accent-hi); font-size: 20px; font-weight: 800; letter-spacing: 3px; pointer-events: none;
}
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 24px); opacity: 0;
  max-width: min(520px, calc(100vw - 32px)); padding: 6px 8px; border-radius: 6px;
  background: #16161d; border: 1px solid #2b2c38; color: var(--text); font-size: 13px;
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(228, 106, 131, .55); }
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 4, 6, .6); }
.modal .dialog { max-height: calc(100dvh - 32px); overflow: auto; }
.modal .dialog.wide { width: min(980px, 100%); }
.msg { color: var(--text); line-height: 1.5; white-space: pre-line; margin: 0; }

/* admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs .dbtn { min-height: 34px; font-size: 11px; }
.tabs .dbtn.on { color: #d9ccff; border-color: var(--accent); background: linear-gradient(135deg, #2a1f52, #1a1330); }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; color: var(--text-mute); font-size: 10px; letter-spacing: 1.6px; font-weight: 800; padding: 6px 8px; border-bottom: 1px solid #22222c; }
.tbl td { padding: 8px; border-bottom: 1px solid #191920; color: var(--text-dim); vertical-align: middle; }
.tbl td.main { color: var(--text); }
.tbl .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl .acts button { height: 28px; padding: 0 9px; border-radius: 8px; border: 1px solid #23232d; background: #15151c; color: var(--text-dim); font-size: 10px; font-weight: 800; letter-spacing: 1px; cursor: pointer; }
.tbl .acts button:hover { color: var(--accent-hi); border-color: var(--accent); }
.tbl .acts button.bad:hover { color: var(--danger); border-color: var(--danger); }
.scroll-x { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 10px; font-weight: 800; letter-spacing: 1px; background: #1a1a22; color: var(--text-dim); }
.pill.running, .pill.queued { color: var(--accent-hi); }
.pill.done { color: var(--success); }
.pill.failed { color: var(--danger); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.problems { max-height: 40dvh; overflow: auto; }
.problems p { margin: 4px 0; color: var(--text-dim); font-size: 12px; line-height: 1.45; }

/* the bottom bar a phone or tablet keeps in reach */
.dock { display: none; }
.menubtn, .newtile, .emptybox, .sheetgrip, .sheetclose, .sheetout, .dockout, .dockgear { display: none; }
.sheethead { display: block; }
.tile .mp { display: none; }

/* ===================================================================== */
/* tablet: the same pieces, picture on top, rail and panel below          */
/* ===================================================================== */
@media (max-width: 1099px) {
  body { overflow: auto; }
  .app { position: static; min-height: 100dvh; overflow: visible; padding: 0 0 96px;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: "head head" "card card" "rail export"; gap: 4px 12px; }
  .headbar { position: static; grid-area: head; height: auto; min-height: 56px; padding: 8px 16px 0; flex-wrap: wrap; }
  .card { position: relative; inset: auto; grid-area: card; margin: 0 9px; height: min(62dvh, 760px); }
  .glass { position: relative; inset: auto; left: auto; right: auto; top: auto; bottom: auto; width: auto; max-height: none; }
  .rail { grid-area: rail; margin: 0 0 0 12px; min-height: 260px; }
  .rail .list { flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
  .tile { flex: 0 0 96px; width: 96px; }
  .export { grid-area: export; margin: 0 12px 0 0; overflow: visible; }
  .export .recover-slot { display: none; }
  .dock {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; gap: 0; align-items: center;
    padding: 4px 9px calc(4px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(12, 12, 16, 0), rgba(12, 12, 16, .94) 28%, var(--bg));
  }
  .dock .nb { margin: 7px; }
  .dock #dockRecover { flex: 1 1 auto; width: auto; min-width: 0; }
  .dock #dockAdd { width: 56px; flex: 0 0 56px; font-size: 20px; padding: 0; }
}

/* ===================================================================== */
/* phone: one column                                                      */
/* ===================================================================== */
@media (max-width: 699px) {
  /* one screen, no page scroll: title bar, the strip, the picture; the
     settings come up from the bottom */
  body { overflow: hidden; }
  .app { position: fixed; inset: 0; min-height: 0; display: flex; flex-direction: column; gap: 0;
    padding: 0 0 calc(96px + env(safe-area-inset-bottom)); overflow: hidden; }
  .headbar { order: 0; flex: 0 0 auto; height: 58px; min-height: 58px; padding: 0 6px 0 16px; flex-wrap: nowrap; gap: 0;
    border-bottom: 1px solid #1b1b23; }
  .apptitle { font-size: 21px; letter-spacing: 1.5px; }
  .appsub, .headbar .version, #adminBtn, #pwBtn, #logoutBtn { display: none; }
  .menubtn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: transparent; color: var(--text-dim); cursor: pointer; }
  .menubtn:active { background: #16161d; }

  .rail { order: 1; flex: 0 0 auto; position: static; margin: 0; padding: 14px 0 12px; min-height: 0; border: 0; border-radius: 0;
    background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
  .rail .add, .rail .clear { display: none; }
  .railwell { margin: 0; padding: 0 0 0 14px; background: none; box-shadow: none; border-radius: 0; flex-direction: row; gap: 9px; align-items: center; }
  .newtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: 0 0 72px; width: 72px; height: 72px;
    border: 0; border-radius: 14px; cursor: pointer; color: var(--text-dim); font-size: 13px; font-weight: 600;
    background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom)); box-shadow: 3px 3px 9px #000, -3px -3px 9px rgba(255, 255, 255, .094); }
  .newtile span { font-size: 28px; line-height: 26px; font-weight: 300; color: var(--accent-hi); }
  .newtile:active { box-shadow: var(--inset); }
  .rail .list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 9px; padding: 6px 14px 6px 0; scrollbar-width: none; }
  .rail .list::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 72px; width: 72px; height: 72px; }
  .tile .sq { width: 72px; height: 72px; border-radius: 14px; }
  .tile .sq img { border-radius: 12px; }
  .tile .x { right: -5px; top: -5px; }
  .tile.done .dot { display: none; }
  .tile .mp { display: block; position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 9px;
    background: rgba(12, 12, 16, .78); color: #e9eaf1; font-size: 10.5px; font-weight: 600; pointer-events: none; }
  .tile:not(.done) .mp { display: none; }

  .card { order: 2; flex: 1 1 auto; min-height: 0; position: relative; inset: auto; height: auto; margin: 0 12px; padding: 8px 8px 4px; gap: 4px; }
  .zoomrow { min-height: 38px; gap: 4px; padding: 0; }
  .zoomrow .movehint { display: none; }
  .zoomrow .fit { width: auto; flex: 0 0 auto; padding: 0 10px; height: 24px; }
  .zoomrow .icon { width: 30px; height: 30px; flex: 0 0 30px; line-height: 30px; }
  .emptybox:not([hidden]) { display: flex; position: absolute; inset: 2px; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: 12px; background: #141419; color: var(--text); cursor: pointer; padding: 20px; text-align: center; }
  .emptybox svg { color: #e9eaf1; margin-bottom: 18px; }
  .emptybox b { font-size: 21px; font-weight: 600; line-height: 1.3; }
  .emptybox span { color: var(--text-dim); font-size: 14px; }

  /* the floating bar: output size, settings, recover */
  .dock { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); top: auto; z-index: 30;
    align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 22px;
    background: rgba(18, 18, 24, .94); border: 1px solid #23232d; box-shadow: 0 14px 40px rgba(0, 0, 0, .7);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .dock #dockAdd { display: none; }
  .dockout { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; line-height: 1.25; }
  .dockout span { color: var(--text-dim); font-size: 12px; }
  .dockout b { color: var(--text); font-size: 15px; font-weight: 600; white-space: nowrap; }
  .dockgear { display: flex; align-items: center; justify-content: center; flex: 0 0 46px; width: 46px; height: 46px; border-radius: 14px; border: 0; cursor: pointer;
    color: var(--text-dim); background: linear-gradient(135deg, var(--surface-top), var(--surface-bottom)); box-shadow: 3px 3px 9px #000, -3px -3px 9px rgba(255, 255, 255, .094); }
  .dockgear:active { box-shadow: var(--inset); color: var(--accent-hi); }
  .dock #dockRecover { flex: 1 1 auto; width: auto; min-width: 0; margin: 0; height: 46px; border-radius: 14px; font-size: 12.5px; }

  /* RECOVER & EXPORT as a sheet from the bottom */
  .export { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; margin: 0; z-index: 50;
    max-height: 88dvh; overflow-y: auto; border-radius: 24px 24px 0 0; border: 1px solid #23232d; border-bottom: 0;
    padding: 6px 18px calc(16px + env(safe-area-inset-bottom)); background: #111116; -webkit-backdrop-filter: none; backdrop-filter: none;
    transform: translateY(105%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); }
  .export.open { transform: none; }
  .sheetback:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .55); }
  .sheetgrip { display: block; width: 52px; height: 5px; border-radius: 3px; background: #2f3040; margin: 4px auto 6px; flex: 0 0 auto; }
  .sheethead { display: flex; align-items: center; justify-content: space-between; }
  .sheetclose { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; border: 0; cursor: pointer;
    background: #1b1b23; color: var(--text-dim); font-size: 15px; }
  .export .recover-slot { display: block; }
  .sheetout { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 14px; padding: 12px 2px 2px; border-top: 1px solid #1f1f28; margin-top: 8px; }
  .sheetout b { color: var(--text); font-weight: 600; }

  .grid2, .dialog .row2 { grid-template-columns: 1fr; }
  .dialog { padding: 22px 18px 22px; }
  .dialog .brand { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
}
