/* Added to the file manager (File Browser). Everything here uses the file manager's own colours (its CSS
   variables), type, icon font and card look, so it follows the light and the dark theme. */
:root { --jin-link: #1565c0; --jin-accent: #1565c0; --jin-accent-hover: #0d47a1; --jin-warn: #b45309; --jin-open-bg: #c8e6c9; --jin-open-text: #1b5e20; }
:root.dark { --jin-link: #90caf9; --jin-accent: #1976d2; --jin-accent-hover: #1565c0; --jin-warn: #fdbc4b; --jin-open-bg: #1b5e20; --jin-open-text: #c8e6c9; }

.jin-offscreen { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* --- the bar under the breadcrumbs --- */
.jin-bar { container-type: inline-size; margin: 1em 0 0; border-radius: 0.2em; background: var(--surfacePrimary); color: var(--textSecondary); box-shadow: rgba(0, 0, 0, 0.06) 0 1px 3px, rgba(0, 0, 0, 0.12) 0 1px 2px; }
#jin-bar ~ div > #listing { min-height: calc(100vh - 8em - var(--jin-bar-space, 0px)); }
.jin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 0.6em 1em; padding: 0.9em 1em; }
.jin-row + .jin-row { border-top: 1px solid var(--divider); }
.jin-row > .material-icons { flex: none; margin-top: 0.05em; color: var(--blue); }
.jin-main { min-width: 0; display: grid; gap: 0.3em; }
.jin-main p { margin: 0; }
.jin-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3em 0.6em; font-weight: 500; overflow-wrap: anywhere; }
.jin-when { font-size: 0.85em; font-weight: 400; color: var(--textPrimary); }
.jin-url { overflow-wrap: anywhere; }
.jin-url a, .jin-note a { color: var(--jin-link); text-decoration: underline; text-underline-offset: 2px; }
.jin-note { font-size: 0.9em; color: var(--textPrimary); overflow-wrap: anywhere; }
.jin-warn { display: flex; align-items: flex-start; gap: 0.4em; color: var(--textSecondary); }
.jin-warn .material-icons { flex: none; font-size: 1.25em; color: var(--jin-warn); }
.jin-chip { display: inline-flex; align-items: center; gap: 0.25em; padding: 0.15em 0.7em 0.15em 0.45em; border-radius: 1em; background: var(--surfaceSecondary); color: var(--textSecondary); font-size: 0.8em; font-weight: 400; white-space: nowrap; }
.jin-chip .material-icons { font-size: 1.15em; }
.jin-chip-open { background: var(--jin-open-bg); color: var(--jin-open-text); }
.jin-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.25em 0.5em; }
/* A narrow bar (a phone, or a small window next to the side menu): the buttons go under the text. */
@container (max-width: 760px) {
  .jin-row { grid-template-columns: auto minmax(0, 1fr); }
  .jin-actions { grid-column: 2; justify-content: flex-start; }
}

/* --- buttons: the file manager's, with an icon and a visible keyboard focus --- */
.jin-btn { display: inline-flex; align-items: center; gap: 0.35em; min-height: 2.5em; font-size: 0.95em; line-height: 1.2; text-transform: none; text-decoration: none; white-space: nowrap; touch-action: manipulation; }
.jin-btn:not(.button--flat) { background: var(--jin-accent); }
.jin-btn:not(.button--flat):hover { background: var(--jin-accent-hover); }
.jin-btn.button--flat, .jin-dialog .button--flat { color: var(--jin-link); }
.jin-dialog .button--flat.button--grey { color: var(--textPrimary); }
/* Names of accounts and folders stand in these buttons: they keep their capitals. */
.jin-dialog .button { text-transform: none; }
.jin-btn.button--flat.button--red, .jin-dialog .button--flat.button--red { color: var(--dark-red); }
:root.dark .jin-btn.button--flat.button--red, :root.dark .jin-dialog .button--flat.button--red { color: #ef9a9a; }
.jin-btn .material-icons { font-size: 1.25em; }
.jin-btn:focus-visible, .jin-bar a:focus-visible, .jin-bar .action:focus-visible, .jin-dialog .button:focus-visible, .jin-dialog .input:focus-visible,
.jin-preview .action:focus-visible, .jin-preview a:focus-visible, .jin-preview select:focus-visible, .jin-preview summary:focus-visible, .jin-float a:focus-visible { outline: 2px solid var(--jin-link); outline-offset: 2px; }
.jin-btn[aria-busy="true"] { opacity: 1; cursor: progress; }
.jin-spin { animation: jin-spin 0.9s linear infinite; }
@keyframes jin-spin { to { transform: rotate(360deg); } }
@media (pointer: coarse) {
  .jin-btn { min-height: 2.75em; }
}

/* --- an HTML file open in the editor --- */
.jin-float { position: fixed; left: 50%; bottom: 1.2em; z-index: 9998; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4em 0.75em; max-width: calc(100vw - 2em); padding: 0.5em 0.6em 0.5em 1em; border-radius: 0.2em; background: var(--surfacePrimary); color: var(--textSecondary); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); transform: translateX(-50%); }
.jin-float > .material-icons { color: var(--blue); }
.jin-float-text { font-weight: 500; }

/* --- dialogs: the file manager's card --- */
dialog.jin-dialog { margin: 0; padding: 0; border: 0; background: var(--surfacePrimary); color: var(--textSecondary); overscroll-behavior: contain; }
dialog.jin-dialog-wide { max-width: 32em; }
dialog.jin-dialog::backdrop, dialog.jin-preview::backdrop { background: rgba(0, 0, 0, 0.5); }
.jin-dialog .card-content p { margin: 0 0 0.6em; word-break: keep-all; overflow-wrap: anywhere; }
.jin-label { display: block; margin: 1em 0 0.4em; font-weight: 500; }
.jin-slug-row { display: flex; align-items: stretch; min-width: 0; margin-bottom: 0.4em; }
.jin-slug-prefix { display: flex; align-items: center; max-width: 55%; padding: 0 0.6em; border: 1px solid var(--borderPrimary); border-right: 0; background: var(--surfaceSecondary); color: var(--textSecondary); font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jin-slug-row .input { flex: 1; min-width: 0; font-size: 1em; }
.jin-slug-row .input[aria-invalid] { border-color: var(--red); }
.jin-help { font-size: 0.9em; color: var(--textPrimary); }
.jin-field-error:not(:empty) { font-weight: 500; color: var(--dark-red); }
:root.dark .jin-field-error:not(:empty) { color: #ef9a9a; }
.jin-dialog .input[aria-invalid] { border-color: var(--red); }
.jin-check { display: flex; align-items: center; gap: 0.5em; width: fit-content; min-height: 2.75em; margin-top: 0.4em; cursor: pointer; }
.jin-check input { width: 1.15em; height: 1.15em; margin: 0; accent-color: var(--jin-accent); }
.jin-check input:focus-visible { outline: 2px solid var(--jin-link); outline-offset: 2px; }
.jin-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.5em 1.2em; align-items: baseline; margin: 1em 0; }
.jin-facts dt { font-weight: 500; color: var(--textPrimary); }
.jin-facts dd { margin: 0; overflow-wrap: anywhere; user-select: all; }
.jin-secret { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 1.1em; }
.jin-link-text { font-size: 0.9em; line-height: 1.4; }
.jin-deploy-extra { display: grid; gap: 0.6em; justify-items: start; }
.jin-deploy-extra:not(:empty) { margin: 0.4em 0 0.8em; }

/* --- the preview, over the whole window --- */
dialog.jin-preview { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--background); color: var(--textSecondary); overflow: hidden; }
dialog.jin-preview[open] { display: flex; flex-direction: column; }
.jin-pv-head { position: relative; z-index: 1; flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em 1em; min-height: 4em; padding: 0.5em 1em 0.5em 0.5em; background: var(--surfacePrimary); border-bottom: 1px solid var(--divider); box-shadow: 0 0 5px var(--borderPrimary); }
.jin-pv-title { flex: 1 1 12em; min-width: 0; display: grid; line-height: 1.35; }
.jin-pv-title strong { font-size: 1.1em; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jin-pv-title a { justify-self: start; max-width: 100%; color: var(--jin-link); font-size: 0.85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jin-pv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em 1em; }
.jin-seg { display: inline-flex; min-width: 0; margin: 0; padding: 0; border: 1px solid var(--borderSecondary); border-radius: 0.2em; }
.jin-seg-item { position: relative; display: inline-flex; }
.jin-seg-item + .jin-seg-item { border-left: 1px solid var(--borderSecondary); }
.jin-seg-item input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.jin-seg-item label { display: inline-flex; align-items: center; gap: 0.3em; min-height: 2.5em; padding: 0 0.8em; font-size: 0.9em; white-space: nowrap; }
.jin-seg-item label .material-icons { font-size: 1.3em; color: var(--action); }
.jin-seg-item input:checked + label { background: var(--jin-accent); color: #fff; }
.jin-seg-item input:checked + label .material-icons { color: #fff; }
.jin-seg-item input:focus-visible + label { outline: 2px solid var(--jin-link); outline-offset: 2px; }
@media (pointer: coarse) {
  .jin-seg-item label { min-height: 2.75em; }
}
.jin-pv-page-slot:empty { display: none; }
.jin-pv-page { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.9em; min-width: 0; }
.jin-pv-page select { max-width: 16em; padding: 0.45em 0.6em; font-size: 1em; }
.jin-pv-stage { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; align-items: flex-start; background: var(--surfaceSecondary); overflow: hidden; }
.jin-pv-device { flex: none; background: #fff; box-shadow: 0 0 0 1px var(--borderSecondary); overflow: hidden; }
.jin-pv-frame { display: block; border: 0; background: #fff; transform-origin: 0 0; }
.jin-pv-foot { flex: none; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.3em 1.5em; max-height: 40dvh; padding: 0.6em 1em; padding-bottom: max(0.6em, env(safe-area-inset-bottom)); background: var(--surfacePrimary); border-top: 1px solid var(--divider); color: var(--textPrimary); font-size: 0.9em; overflow: auto; overscroll-behavior: contain; }
.jin-pv-foot p { margin: 0; }
.jin-pv-size { font-variant-numeric: tabular-nums; }
.jin-pv-check { min-width: 0; color: var(--textSecondary); }
.jin-pv-ok, .jin-pv-failed summary { display: flex; align-items: center; gap: 0.35em; }
.jin-pv-ok .material-icons { font-size: 1.25em; color: var(--icon-green); }
.jin-pv-failed summary { font-weight: 500; cursor: pointer; }
.jin-pv-failed summary .material-icons { font-size: 1.25em; color: var(--jin-warn); }
.jin-pv-failed ul { margin: 0.4em 0 0; padding-left: 1.4em; overflow-wrap: anywhere; }
.jin-pv-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em 1em; margin-top: 0.5em; }
.jin-pv-fix p { flex: 1 1 20em; }

/* --- messages --- */
.jin-toasts { position: fixed; left: 50%; bottom: max(1.5em, env(safe-area-inset-bottom)); z-index: 10001; display: grid; gap: 0.5em; justify-items: center; width: max-content; max-width: calc(100vw - 2em); transform: translateX(-50%); pointer-events: none; }
.jin-toast { display: flex; align-items: center; gap: 0.5em; margin: 0; padding: 0.7em 1em; border-radius: 0.2em; background: #323232; color: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); overflow-wrap: anywhere; }
.jin-toast .material-icons { flex: none; font-size: 1.3em; color: #81c784; }
.jin-toast-error .material-icons { color: #ffab91; }

@media (prefers-reduced-motion: reduce) {
  .jin-spin { animation: none; }
}

/* --- user management: the password column and the issue button --- */
.dashboard .row .column.jin-users-column { width: 100%; }
.jin-users-card th { white-space: nowrap; }
.jin-users-card .card-title { flex-wrap: wrap; gap: 0.5em; align-items: center; }
.jin-users-card .card-title > .jin-btn { text-transform: none; }
.jin-users-card .card-content { overflow-x: auto; overscroll-behavior-x: contain; }
.jin-td { white-space: nowrap; }
.jin-td > * { vertical-align: middle; }
.jin-td .jin-btn { margin-left: 0.2em; }
.jin-state { display: inline-flex; align-items: center; gap: 0.35em; margin-right: 0.6em; color: var(--textSecondary); }
.jin-state .material-icons { font-size: 1.25em; color: var(--textPrimary); }

/* --- an invitation link, on the file manager's login page --- */
.jin-invite-note { display: flex; gap: 0.5em; align-items: flex-start; margin: 0 0 0.75em; padding: 0.75em 0.9em; border-radius: 0.2em; background: var(--surfaceSecondary); color: var(--textSecondary); font-size: 0.95em; line-height: 1.5; text-align: left; word-break: keep-all; overflow-wrap: anywhere; }
.jin-invite-note:empty { display: none; }
.jin-invite-note .material-icons { flex: none; font-size: 1.3em; line-height: 1.15; color: var(--dark-red); }
:root.dark .jin-invite-note .material-icons { color: #ef9a9a; }
.jin-invite-failed { box-shadow: inset 3px 0 0 var(--dark-red); }
