/* 2000年代の個人運営のアップローダーのような、装飾の少ない画面にする。
   角丸、影、グラデーション、アニメーション、Webフォントは使わない。
   フォームと情報の表は、見出しのセルに背景色を付けた枠で囲む。
   枠線は #8fa5bf、見出しの背景は #dfe7f1 にそろえる。 */

html {
  background: #fff;
}

body {
  margin: 0 auto;
  padding: 8px 12px 24px;
  max-width: 1100px;
  background: #fff;
  color: #000;
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: #00c;
  text-decoration: underline;
}

a:visited {
  color: #551a8b;
}

h1 {
  font-size: 20px;
  margin: 12px 0 8px;
}

h2 {
  font-size: 16px;
  margin: 20px 0 6px;
  padding: 3px 6px;
  border: 1px solid #8fa5bf;
  border-left: 6px solid #4a6fa5;
  background: #dfe7f1;
}

h3 {
  font-size: 14px;
  margin: 16px 0 6px;
}

[hidden] {
  display: none !important;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid #999;
}

header.site .title {
  font-weight: bold;
  color: #000;
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

footer.site {
  margin-top: 32px;
  padding-top: 4px;
  border-top: 1px solid #999;
  font-size: 12px;
}

footer.site a,
.toc a {
  margin-right: 12px;
}

form.inline {
  display: inline;
  margin: 0;
}

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 14px;
}

button {
  padding: 3px 10px;
  border: 1px solid #777;
  border-radius: 0;
  background: #eee;
  color: #000;
  cursor: pointer;
}

button:hover {
  background: #ddd;
}

button:disabled {
  color: #888;
  cursor: default;
}

/* ダウンロードとアップロードのボタン */
button.primary,
a.button {
  display: inline-block;
  padding: 6px 28px;
  border: 1px solid #1d4380;
  background: #2a5db0;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-decoration: none;
}

button.primary:hover,
a.button:hover {
  background: #1d4380;
}

button.primary:disabled {
  border-color: #889;
  background: #99a;
}

a.button:visited {
  color: #fff;
}

/* 削除、停止、無効化のような取り消せない操作のボタン */
button.danger {
  border-color: #b00;
  background: #fde4e4;
  color: #b00;
  font-weight: bold;
}

button.danger:hover {
  background: #f8c8c8;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea {
  border: 1px solid #888;
  border-radius: 0;
  padding: 2px 4px;
  background: #fff;
  color: #000;
  max-width: 100%;
  box-sizing: border-box;
}

.wide {
  width: 32em;
}

.short {
  width: 6em;
}

textarea.wide {
  width: 40em;
}

.mono {
  font-family: monospace;
}

.hint {
  color: #555;
  font-size: 12px;
}

/* アップロードの制限。拡張子は1つずつ枠で囲んで区切る */
.limits {
  margin: 0;
  padding: 6px 8px;
  border-top: 1px solid #8fa5bf;
  color: #333;
  font-size: 12px;
}

.limits .item {
  margin-right: 16px;
  white-space: nowrap;
}

.limits .exts {
  display: block;
  margin-top: 4px;
}

.limits .ext {
  display: inline-block;
  margin: 2px 4px 0 0;
  padding: 0 4px;
  border: 1px solid #8fa5bf;
  background: #fff;
  font-family: monospace;
}

.notes {
  margin: 4px 0;
  padding-left: 20px;
}

.error {
  color: #c00;
  font-weight: bold;
}

.ok {
  color: #060;
  font-weight: bold;
}

.description,
.comment,
.memo,
.desc {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.description {
  margin: 8px 0;
  padding: 6px 8px;
  border: 1px solid #ccc;
}

/* 表 */

table {
  border-collapse: collapse;
}

table.grid th,
table.grid td,
table.files th,
table.files td,
table.info th,
table.info td {
  border: 1px solid #000;
  padding: 3px 6px;
  vertical-align: top;
}

table.grid th,
table.grid td,
table.files th,
table.files td,
table.info th,
table.info td {
  border-color: #8fa5bf;
}

table.grid th,
table.files th,
table.info th {
  background: #dfe7f1;
  font-weight: bold;
  text-align: left;
  white-space: nowrap;
}

table.form {
  border: 1px solid #8fa5bf;
}

table.form th,
table.form td {
  border: 1px solid #8fa5bf;
  padding: 5px 8px;
  vertical-align: top;
}

table.form th {
  background: #dfe7f1;
  text-align: left;
  font-weight: bold;
  white-space: nowrap;
}

table.form td {
  background: #fff;
}

/* 送信ボタンだけの行は、見出しのセルを空けておく */
table.form th:empty {
  background: #f3f6fa;
}

.num,
td.no,
td.size,
td.dl {
  text-align: right;
  white-space: nowrap;
}

td.date,
.nowrap,
table.files td.extra {
  white-space: nowrap;
}

.scroll {
  overflow-x: auto;
}

.state-hidden {
  color: #c00;
}

/* アップロードのフォーム */

.upload {
  margin: 12px 0;
  border: 1px solid #8fa5bf;
  background: #f3f6fa;
}

.upload table.form {
  width: 100%;
  border: 0;
}

.upload table.form tr:first-child th,
.upload table.form tr:first-child td {
  border-top: 0;
}

.upload table.form th:first-child {
  border-left: 0;
}

.upload table.form td:last-child {
  border-right: 0;
}

.upload table.form tr:last-child th,
.upload table.form tr:last-child td {
  border-bottom: 0;
}

.upload p {
  margin: 4px 8px;
}

.upload p.limits {
  margin: 0;
}

progress {
  width: 160px;
  vertical-align: middle;
}

/* ファイル一覧 */

.search {
  margin: 12px 0 4px;
}

.search button {
  margin-left: 6px;
}

.count {
  margin: 4px 0;
}

.pager {
  margin: 4px 0;
}

.pager a,
.pager strong {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid #8fa5bf;
  text-align: center;
}

.pager strong {
  background: #dfe7f1;
}

table.files {
  width: 100%;
}

table.files th.sortable a {
  color: #000;
}

table.files td.thumb {
  width: 120px;
  text-align: center;
  vertical-align: middle;
}

table.files td.thumb img {
  display: block;
  max-width: 120px;
  max-height: 120px;
  margin: 0 auto;
  border: 0;
}

table.files td.name {
  overflow-wrap: anywhere;
  min-width: 10em;
}

/* 一覧のコメントは3行までにし、続きは個別ページで表示する */
table.files .clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.lock {
  margin-right: 4px;
}

/* 個別ページ */

.filename {
  overflow-wrap: anywhere;
}

.preview img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #000;
}

table.info {
  margin: 8px 0;
}

table.info td {
  min-width: 16em;
}

.download {
  margin: 16px 0;
}

.download form {
  display: inline-block;
  padding: 8px;
  border: 1px solid #8fa5bf;
  background: #f3f6fa;
}

.download form button {
  margin-top: 4px;
}

details.report,
details.claim {
  margin: 16px 0;
}

details summary {
  cursor: pointer;
  color: #00c;
  text-decoration: underline;
}

details form {
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid #8fa5bf;
  background: #f3f6fa;
}

form#delete {
  padding: 6px 8px;
  border: 1px solid #8fa5bf;
  border-top: 0;
  background: #f3f6fa;
}

form#delete p {
  margin: 4px 0 0;
}

#deleteHeading {
  margin-bottom: 0;
}

details form label {
  margin-right: 12px;
  white-space: nowrap;
}

#reportDetail {
  width: 32em;
}

/* 管理画面 */

.mine {
  margin: 4px 0;
  padding-left: 20px;
}

.issued {
  margin: 8px 0;
  padding: 6px 8px;
  border: 1px solid #c00;
}

.issued p {
  margin: 4px 0;
}

.filename-small {
  font-size: 12px;
  overflow-wrap: anywhere;
}

table.grid td.memo {
  min-width: 10em;
  max-width: 24em;
}

table.grid td.name {
  min-width: 8em;
  overflow-wrap: anywhere;
}

/* 画面幅が600px未満のときは、ファイル一覧の表を1件ずつのブロック表示にする */

@media (max-width: 599px) {
  body {
    padding: 6px 8px 24px;
  }

  .wide,
  textarea.wide,
  #reportDetail {
    width: 100%;
  }

  table.form,
  table.form tbody,
  table.form tr,
  table.form th,
  table.form td {
    display: block;
  }

  table.form {
    border-bottom: 0;
  }

  table.form th,
  table.form td {
    border-width: 0 0 1px;
  }

  table.form th {
    padding: 3px 8px;
  }

  table.form th:empty {
    display: none;
  }

  .upload table.form tr:last-child td {
    border-bottom: 0;
  }

  /* 入力欄の横のヒントは、入力欄の下に表示する */
  .hint {
    display: block;
    margin-top: 2px;
  }

  /* ページ送りは1行に収めるため、番号の間の空白の代わりに2pxの間隔を置く */
  .pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 2px;
  }

  /* ページ送りのリンクは、押せる範囲を縦横44px以上にする */
  .pager a,
  .pager strong {
    min-width: 44px;
    min-height: 44px;
    line-height: 42px;
    padding: 0 8px;
    box-sizing: border-box;
    margin-bottom: 4px;
  }

  table.files thead {
    display: none;
  }

  table.files,
  table.files tbody,
  table.files tr,
  table.files td {
    display: block;
    width: auto;
  }

  table.files tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    border: 1px solid #8fa5bf;
  }

  table.files td.name {
    order: -1;
  }

  table.files td {
    border: 0;
    border-bottom: 1px solid #ccc;
    padding: 2px 6px;
    text-align: left;
  }

  table.files td:last-child {
    border-bottom: 0;
  }

  table.files td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 6em;
    color: #555;
    font-size: 12px;
  }

  table.files td.empty,
  table.files td.thumb::before,
  table.files td.name::before {
    display: none;
  }

  table.files td.name {
    background: #dfe7f1;
    font-weight: bold;
  }

  /* 管理画面の表は横にスクロールさせ、メモと名前以外のセルは改行しない */
  table.grid td:not(.memo):not(.name) {
    white-space: nowrap;
  }

  table.files td.thumb {
    width: auto;
    text-align: left;
  }

  table.files td.thumb img {
    margin: 0;
  }

  table.info td {
    min-width: 0;
  }
}
