:root {
  --fg: #1d1d1f; --muted: #6b6b70; --line: #e3e3e6; --bg: #fff; --soft: #f6f7f9;
  --accent: #1d6fa5; --accent-fg: #fff; --ok: #1f7a3a; --ok-bg: #e8f4ea; --warn: #fdf3e1;
  --folder: #2382be;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
.sprite { display: none; }
header.top { display: flex; gap: 1rem; align-items: center; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); }
header.top .brand { display: flex; align-items: center; gap: .75rem; font-weight: 600; color: var(--fg); text-decoration: none; margin-right: auto; }
header.top .brand img { height: 32px; width: auto; }
header.top .who { color: var(--muted); }
/* As wide as the content needs (a long invoice table), from 72rem up to 95% of the window. */
main { width: fit-content; min-width: min(72rem, 100%); max-width: 95vw; margin: 0 auto; padding: 1.25rem; }
h1 { font-size: 1.5rem; margin: .25rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0; }
a { color: var(--accent); }
code, .path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
/* the current path as the page heading: not bold, its last node bold */
h1.path { font-weight: 400; }
h1.path a { text-decoration: none; }
h1.path strong { font-weight: 700; }
h1.path .sep { color: var(--muted); }
.muted, small { color: var(--muted); }

/* login */
.login { max-width: 32rem; margin: 3rem auto; text-align: center; }
.login img { height: 80px; width: auto; }
.login h1 { font-size: 1.3rem; font-weight: 500; margin: 1.5rem 0; }

/* icons */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.icon.folder { fill: var(--folder); }
.icon.file { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.icon.ok { fill: var(--ok-bg); stroke: var(--ok); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.open { fill: none; stroke: #b5b5ba; stroke-width: 1.8; }
.icon.reset { fill: #fdf3e1; stroke: #b26a00; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.updated { display: flex; align-items: center; gap: .3rem; margin: .15rem 0 0 1.6rem; font-size: .85rem; color: #8a5300; }
.updated .icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; width: 1em; height: 1em; }
.updated.after-post { color: #a32020; font-weight: 600; }
dd .updated { display: inline-flex; margin: 0 0 0 .5rem; }

/* the folder tree */
ul.tree, ul.tree ul { list-style: none; margin: 0; padding: 0; }
ul.tree > li { margin: 0 0 .6rem; }
ul.tree ul { margin: .15rem 0 0 .55rem; padding-left: 1.1rem; border-left: 1px solid var(--line); }
ul.tree .node { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .35rem; border-radius: 6px; }
ul.tree a.node { color: var(--fg); text-decoration: none; }
ul.tree a.node:hover, ul.tree a.node:focus-visible { background: var(--soft); color: var(--accent); }

/* a folder */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; align-items: baseline; color: var(--muted); margin: 1.5rem 0 .75rem; }
.toolbar .links { display: flex; flex-wrap: wrap; gap: .5rem .6rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; font-size: .9rem; color: var(--muted); }
td.name { white-space: nowrap; }
td.name a { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; }
td.name a:hover span { text-decoration: underline; }
td.changed { white-space: nowrap; color: var(--muted); }
/* date and status as small as the person's address in the status */
td.changed, td.status { font-size: .833rem; }
td.status small { font-size: 1em; }
th.action { text-align: right; }
.st { display: inline-flex; align-items: center; gap: .45rem; }
tr.posted td.name a { color: var(--muted); }
td.action { text-align: right; white-space: nowrap; }

form.inline { display: inline; margin: 0; }
button, a.button {
  font: inherit; display: inline-block; padding: .35rem .8rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; text-align: center;
}
form.status button:not(.link) { width: 16.5rem; }
button.secondary, a.button.secondary { background: var(--bg); color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; width: auto; }
button:disabled { opacity: .55; cursor: progress; }
button.working { opacity: 1; cursor: progress; }
button.working::before {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .45em; vertical-align: -.05em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
body.busy { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.working::before { animation: none; } }

.notice { background: var(--ok-bg); padding: .6rem .8rem; border-radius: 6px; margin-bottom: 1rem; }
.warning { background: var(--warn); padding: .6rem .8rem; border-radius: 6px; margin-bottom: 1rem; }


/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); color: var(--fg); background: var(--bg); }
dialog::backdrop { background: rgba(20, 24, 30, .45); }
dialog .bar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
dialog .bar h2 { word-break: break-word; }
.close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.close:hover, .close:focus-visible { background: var(--soft); color: var(--fg); }
.close .icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
dialog.viewer[open] { width: min(72rem, 96vw); height: 94vh; display: flex; flex-direction: column; }
dialog.viewer .details { display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: center; justify-content: space-between; padding: .5rem 0 .75rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
dialog.viewer dl { display: grid; grid-template-columns: auto auto; gap: .25rem 1rem; margin: 0; }
dialog.viewer dt { color: var(--muted); }
dialog.viewer dd { margin: 0; }
dialog.viewer .action { display: flex; align-items: center; gap: 1.25rem; }
dialog.viewer iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
dialog.history { width: min(56rem, 96vw); max-height: 90vh; }
dialog.history[open]:not(:modal) { position: static; margin: 1rem 0; width: auto; box-shadow: none; }
dialog.history pre { background: var(--soft); padding: .5rem; overflow: auto; }

@media (max-width: 44rem) {
  main { padding: 1rem; }
  header.top { padding: .5rem 1rem; gap: .75rem; }
  header.top .who { display: none; }
  header.top .brand span { font-size: .9rem; }
  /* one block per invoice instead of a table row */
  table.files thead { display: none; }
  table.files, table.files tbody, table.files tr, table.files td { display: block; width: 100%; }
  table.files tr { border-bottom: 1px solid var(--line); padding: .6rem 0; }
  table.files td { border: 0; padding: .15rem 0; }
  td.name { white-space: normal; }
  td.name a { word-break: break-word; }
  td.changed { font-size: .9rem; }
  td.action { text-align: left; white-space: normal; padding-top: .4rem; }
  form.status button:not(.link) { width: 100%; }
  dialog.viewer[open] { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border-radius: 0; padding: .75rem; }
  dialog.viewer .action { width: 100%; justify-content: space-between; }
}
