:root {
  color-scheme: light;
  --canvas: #f6f8fc;
  --surface: #fff;
  --ink: #1f1f1f;
  --muted: #444746;
  --faint: #5e5e5e;
  --line: #e1e3e1;
  --hairline: #f1f3f4;
  --blue: #0b57d0;
  --blue-deep: #0842a0;
  --search: #e9eef6;
  --hover-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Roboto, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
  background: var(--canvas);
}

button, input, select, textarea { font: inherit; }

a { color: var(--blue); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 16px;
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 13.5rem;
  flex: none;
  text-decoration: none;
  color: inherit;
  line-height: 1.25;
}

.brand-name {
  font-size: 22px;
  font-weight: 400;
  color: #5f6368;
}

.brand-sub {
  font-size: 11px;
  color: #747775;
  white-space: nowrap;
}

.manage-link {
  flex: none;
  font-size: 13px;
  text-decoration: none;
}

/* スマホの幅でだけ使う、検索の欄の開け閉め。 */
.search-toggle-box,
.search-toggle { display: none; }

.manage-form {
  margin: 16px 0;
}

.search {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  min-height: 48px;
  margin: 0;
  padding: 0 8px 0 12px;
  background: var(--search);
  border: 0;
  border-radius: 24px;
}

.search:focus-within {
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(60, 64, 67, 0.24);
}

.search-icon {
  display: grid;
  place-items: center;
  width: 24px;
  color: var(--muted);
  flex: none;
}

.search-field {
  flex: 1 1 7.5rem;
  min-width: 6.5rem;
  margin: 0;
}

.search input,
.search select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 4px;
  border-radius: 4px;
}

.search input:focus,
.search select:focus { outline: none; }

.search input::placeholder { color: var(--muted); }

.search button,
.search-clear {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
}

.search button:hover,
.search-clear:hover { background: rgba(11, 87, 208, 0.08); }

.sync-banner {
  margin: 0 16px 8px;
  padding: 8px 16px;
  background: #fef7e0;
  color: #5c4300;
  border-radius: 8px;
  font-size: 13px;
}

.shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  align-items: start;
  padding: 0 12px 16px;
  gap: 0 8px;
}

.folders {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 88px);
  overflow: auto;
  padding: 8px 0 16px;
}

.folders .compose-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 4px 8px 12px;
  padding: 8px 16px;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}

.folders .compose-link:hover { background: var(--blue-deep); }

.folders a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
  margin: 0 8px 1px 0;
  padding: 0 12px 0 16px;
  border-radius: 0 16px 16px 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.folders a:hover { background: #e1e3e1; }

.folders a.is-current {
  background: #d3e3fd;
  color: #041e49;
}

.folders .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  flex: none;
}

.folders a.is-current .count { color: #041e49; }

.folders h2 {
  margin: 16px 16px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jobs a {
  font-weight: 400;
  padding-left: 28px;
}

.job-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-empty {
  margin: 0 16px;
  color: var(--faint);
  font-size: 12px;
}

main {
  width: auto;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border-radius: 16px;
  min-height: calc(100vh - 88px);
}

.threads {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.thread-row {
  display: grid;
  grid-template-columns: 40px minmax(8rem, 14rem) minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  min-height: 40px;
  padding: 0 16px 0 12px;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.thread-row + .thread-row { box-shadow: inset 0 1px 0 var(--hairline); }

.thread-row:hover {
  z-index: 1;
  box-shadow: var(--hover-shadow);
}

.thread-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  flex: none;
  user-select: none;
}

.sender {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--ink);
}

.sender-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-mark {
  display: inline-flex;
  flex: none;
  color: var(--muted);
}

.msg-count {
  flex: none;
  color: var(--muted);
}

.msg-count::before { content: "("; }
.msg-count::after { content: ")"; }

.chip {
  flex: none;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  border-radius: 4px;
  background: #e1e3e1;
  color: var(--ink);
  font-size: 12px;
  line-height: 18px;
  height: 18px;
}

/* 下書き＆送信予約済の一覧。書きかけは灰色、送信予約は青。 */
.chip.draft-badge {
  max-width: none;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 9px;
}

.chip.draft-badge.is-draft {
  background: transparent;
  color: #747775;
  border: 1px solid var(--line);
  line-height: 16px;
}

.chip.draft-badge.is-scheduled {
  background: #d3e3fd;
  color: #0842a0;
  font-weight: 500;
}

.chip.is-empty {
  background: transparent;
  color: #747775;
  border: 1px solid var(--line);
  line-height: 16px;
}

.subject-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.subject-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.subject { color: var(--ink); }

.snippet { color: var(--faint); }

.when {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.empty {
  margin: 0;
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

.thread-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--hairline);
}

.toolbar-gap { flex: 1; }

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
}

.icon-button:hover,
.text-button:hover { background: rgba(68, 71, 70, 0.08); }

.text-button {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 16px;
}

.panel h1 {
  margin: 0;
  padding: 16px 56px 4px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.35;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.list-title { padding: 12px 16px 4px; }

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 16px 4px 0;
  color: var(--faint);
  font-size: 12px;
}

.pager a,
.pager-off {
  min-width: 3em;
  text-align: center;
}

.pager a {
  color: var(--blue);
  text-decoration: none;
}

.pager-off { opacity: 0.4; }

.case-line {
  margin: 0;
  padding: 0 56px 8px;
}

.loose-threads h2 {
  margin: 16px 0 4px;
  padding: 0 56px;
  color: #747775;
  font-size: 13px;
  font-weight: 500;
}

.loose-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
}

.loose-row > a { flex: 1; min-width: 0; }

.loose-row button {
  flex: none;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--blue);
  border-radius: 14px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  cursor: pointer;
}

/* 対応済みにする、この差出人は出さない。目立たせない。 */
.thread-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
  padding: 0 56px 10px;
  font-size: 12px;
}

/* フォームの中のボタンを、紐付けのボタンと同じ1列に並べる。順は、対応済み、紐付け、その他へ。 */
.state-bar { display: contents; }

.thread-actions .link-box { order: 2; }

.thread-actions .state-menu,
.thread-actions .state-bar button[value="unmute"],
.thread-actions .state-bar button[value="unmove"] { order: 3; }

.state-bar button {
  height: 28px;
  padding: 0 14px;
  border: 1px solid #c4c7c5;
  border-radius: 14px;
  background: transparent;
  color: #444746;
  font-size: 12px;
  cursor: pointer;
}

.state-bar button:hover { background: rgba(68, 71, 70, 0.08); }

/* 「その他へ」を押すと、一度だけ・常に が出る。 */
.state-menu { position: relative; }

.state-menu summary {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  border: 1px solid #c4c7c5;
  border-radius: 14px;
  color: #444746;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.state-menu summary::-webkit-details-marker { display: none; }

.state-menu summary::after {
  content: "▾";
  margin-left: 6px;
  font-size: 10px;
}

.state-menu summary:hover,
.state-menu[open] summary { background: rgba(68, 71, 70, 0.08); }

.state-choices {
  position: absolute;
  top: 32px;
  left: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 7rem;
  padding: 4px 0;
  border: 1px solid #c4c7c5;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.state-bar .state-choices button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  text-align: left;
  font-size: 13px;
}

.state-bar button.is-main {
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 500;
}

.state-bar button.is-main:hover { background: rgba(11, 87, 208, 0.08); }

.manage-head {
  margin: 28px 0 8px;
  font-size: 15px;
  font-weight: 500;
}

.muted-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.muted-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.muted-list button {
  padding: 2px 10px;
  border: 1px solid var(--blue);
  border-radius: 12px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  cursor: pointer;
}

/* 会話を予約に付ける。普段はたたんでおく。 */
.link-notice { padding: 0 56px; }

.link-box {
  position: relative;
  margin: 0;
  font-size: 13px;
}

.link-box summary {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  border: 1px solid #c4c7c5;
  border-radius: 14px;
  color: #444746;
  font-size: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.link-box summary::-webkit-details-marker { display: none; }

.link-box summary::after {
  content: "▾";
  margin-left: 6px;
  font-size: 10px;
}

.link-box summary:hover,
.link-box[open] summary { background: rgba(68, 71, 70, 0.08); }

.link-panel {
  position: absolute;
  top: 32px;
  left: 0;
  z-index: 5;
  width: min(34rem, calc(100vw - 48px));
  padding: 4px 16px 14px;
  border: 1px solid #c4c7c5;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.link-box form { margin: 8px 0 0; }

.link-box ul {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.link-box li { padding: 3px 0; }

.link-box .link-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.link-box input[type="date"] {
  height: 32px;
  margin-left: 4px;
  padding: 0 8px;
  border: 1px solid #747775;
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
}

.link-box input[type="search"] {
  width: 16rem;
  max-width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #747775;
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
}

.link-box button {
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--blue);
  border-radius: 16px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.link-box .link-pick button {
  background: var(--blue);
  color: #fff;
}

.link-box button.quiet {
  height: auto;
  padding: 2px 0;
  border: 0;
  color: #747775;
  font-size: 12px;
}

.link-box button.quiet:hover { text-decoration: underline; }

.messages {
  list-style: none;
  margin: 0;
  padding: 0 8px;
}

.message { padding: 8px 8px 16px; }

.message + .message { border-top: 1px solid var(--hairline); }

.message-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}

.message-main { display: block; min-width: 0; }

/* メールのたたみ方。見出しの行を押すと開く。たたんだメールは書き出しだけ見せる。 */
.message-fold > summary {
  cursor: pointer;
  list-style: none;
  border-radius: 8px;
}

.message-fold > summary::-webkit-details-marker { display: none; }

.message-fold > summary:hover { background: rgba(68, 71, 70, 0.05); }

.message-peek {
  display: block;
  overflow: hidden;
  color: var(--faint);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-fold[open] > summary .message-peek { display: none; }

.message-fold:not([open]) > summary { padding-bottom: 2px; }

.message:has(> .message-fold:not([open])) { padding-bottom: 8px; }

.message-detail { padding-left: 52px; }

.message-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding-top: 6px;
}

.message-name {
  font-weight: 700;
  white-space: nowrap;
}

.message-addr,
.to-line,
.dir,
.message-head time {
  color: var(--faint);
  font-size: 12px;
}

.message-addr,
.to-line {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-addr { flex: 1 1 auto; }

.dir {
  flex: none;
  white-space: nowrap;
}

.message-head time {
  margin-left: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.to-line { margin: 0; }

.body {
  white-space: pre-wrap;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.body.is-html { white-space: normal; }

.body a { color: var(--blue); }

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.attachment {
  display: inline-block;
  max-width: 320px;
  padding: 6px 12px;
  border: 1px solid #c4c7c5;
  border-radius: 8px;
  color: inherit;
  font-size: 13px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment span { color: #747775; font-size: 12px; }

a.attachment:hover { background: rgba(68, 71, 70, 0.08); }

.reply { padding: 4px 16px 28px 60px; }

.reply h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
}

.notice,
.form-error { margin: 0 0 8px; }

.notice { color: #146c2e; }

.form-error { color: #b3261e; }

.composer {
  border: 1px solid #747775;
  border-radius: 16px;
  padding: 4px 4px 4px 16px;
  background: var(--surface);
}

.composer:focus-within { border-color: var(--blue); }

.case-thread {
  grid-template-columns: minmax(0, 1fr) auto;
}


.composer input[type="email"],
.composer input[type="text"] {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  margin-bottom: 8px;
  color: inherit;
  background: transparent;
}

.gmail-fields {
  margin: 4px 12px 0 -8px;
}

.gmail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
}

.composer .gmail-label {
  display: flex;
  align-items: center;
  flex: none;
  width: 4.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.gmail-from {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer .gmail-row input[type="text"],
.composer .gmail-row input[type="email"] {
  flex: 1;
  width: auto;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 8px 0;
  background: transparent;
}

.gmail-links {
  display: flex;
  flex: none;
  gap: 12px;
  padding-right: 4px;
}

.composer .gmail-link {
  display: inline;
  width: auto;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.composer .gmail-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.gmail-switch {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.gmail-fields .gmail-switch-cc:not(:checked) ~ .gmail-cc,
.gmail-fields .gmail-switch-bcc:not(:checked) ~ .gmail-bcc {
  display: none;
}

.gmail-fields .gmail-switch-cc:checked ~ .gmail-to .gmail-link-cc,
.gmail-fields .gmail-switch-bcc:checked ~ .gmail-to .gmail-link-bcc {
  display: none;
}

.composer button.gmail-fold {
  display: none;
  flex: none;
  width: 28px;
  height: 28px;
  margin-right: 2px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.composer .gmail-row.is-empty button.gmail-fold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer button.gmail-fold:hover {
  background: var(--hairline);
  color: var(--ink);
  box-shadow: none;
}

.composer input:focus { outline: none; }

.composer label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.composer textarea {
  width: 100%;
  border: 0;
  resize: vertical;
  min-height: 72px;
  padding: 12px 12px 0 0;
  color: inherit;
  background: transparent;
}

.composer textarea:focus { outline: none; }

.composer-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 8px 8px 0;
}

.composer button {
  height: 36px;
  padding: 0 24px;
  border: 0;
  border-radius: 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}

.composer button.secondary {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}

/* 書きかけ保存。押すと「確認を依頼する／保存のみ」が上に開く。 */
.keep-menu { position: relative; }

.keep-menu summary {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 20px 0 24px;
  border: 1px solid var(--blue);
  border-radius: 18px;
  color: var(--blue);
  font-size: 13.3333px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.keep-menu summary::-webkit-details-marker { display: none; }

.keep-menu summary::after {
  content: "▾";
  margin-left: 6px;
  font-size: 10px;
}

.keep-menu[open] summary { background: rgba(11, 87, 208, 0.08); }

.keep-choices {
  position: absolute;
  bottom: 40px;
  left: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 10rem;
  padding: 4px 0;
  border: 1px solid #c4c7c5;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.composer .keep-choices button,
.composer .keep-choices button:hover {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #1f1f1f;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.composer .keep-choices button:hover { background: rgba(68, 71, 70, 0.08); }

.chip.draft-badge.is-review {
  background: #fef7e0;
  color: #b06000;
  font-weight: 500;
}

.composer button:hover {
  background: var(--blue-deep);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.composer button:disabled,
.composer button:disabled:hover {
  background: #c4c7c5;
  color: #fff;
  box-shadow: none;
  cursor: not-allowed;
}

.composer button.secondary:disabled,
.composer button.secondary:disabled:hover {
  background: transparent;
  color: #c4c7c5;
  border-color: #c4c7c5;
}

.quote-row {
  padding: 8px 12px 0 0;
  color: #747775;
  font-size: 12px;
}

.quote-row details { display: inline-block; margin-left: 12px; vertical-align: top; }

.quote-row summary { cursor: pointer; }

.quote-row pre {
  margin: 6px 0 0;
  max-height: 200px;
  overflow: auto;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* kintone で選んだテンプレの名前。ここでは選び直せないので、ボタンにはしない。 */
.template-name {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 10px;
  background: #e1e3e1;
  color: #444746;
  font-size: 12px;
  font-weight: 400;
}

/* 送るメールに付けるファイルを選ぶ行。 */
.attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 12px 0 0;
  color: #747775;
  font-size: 12px;
}

.attach-row label { color: inherit; }

.attach-row input[type="file"] {
  max-width: 100%;
  font-size: 12px;
}

/* 添付のときだけ使う口。普段の送信より目立たせない。 */
.composer-aside {
  padding: 0 8px 6px 0;
  text-align: right;
}

.composer button.quiet,
.composer button.quiet:hover {
  height: auto;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #747775;
  font-size: 12px;
  font-weight: 400;
}

.composer button.quiet:hover { text-decoration: underline; }

.composer button.quiet:disabled,
.composer button.quiet:disabled:hover {
  background: transparent;
  color: #c4c7c5;
  text-decoration: none;
}

.roster-q {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.roster-q input[type="search"] {
  flex: 1;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  color: inherit;
  background: transparent;
}

.roster-hits {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.roster-hits li { margin: 0 0 8px; }

.roster-hits button.secondary {
  height: auto;
  min-height: 36px;
  white-space: normal;
  text-align: left;
}

.composer button.secondary:hover {
  background: transparent;
  box-shadow: none;
}

.hint {
  margin: 8px 0 0;
  color: #747775;
  font-size: 12px;
}

@media (max-width: 760px) {
  /* 上の帯は1行。検索の欄は「検索」を押したときだけ下に開く。 */
  .topbar {
    flex-wrap: wrap;
    gap: 4px 8px;
    min-height: 48px;
    padding: 4px 12px;
  }
  .brand { width: auto; flex: 1; }
  .brand-sub { display: none; }
  .search-toggle-box {
    display: block;
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  .search-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 18px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
  }
  .search-toggle-box:checked + .search-toggle { background: #d3e3fd; }
  .search-toggle-box:focus-visible + .search-toggle { outline: 2px solid var(--blue); }
  .search { display: none; order: 4; flex-basis: 100%; }
  .search-toggle-box:checked ~ .search { display: flex; }

  /* 押したときにスマホが画面を拡大しないよう、入力の字は 16px にする。 */
  input,
  select,
  textarea { font-size: 16px; }

  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 8px 12px;
  }
  /* 左メニューは横1行。指で横に送る。 */
  .folders {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding: 2px 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .folders::-webkit-scrollbar { display: none; }
  .folders h2 {
    flex: none;
    margin: 0 2px 0 12px;
  }
  .folders a,
  .jobs a {
    flex: none;
    min-height: 36px;
    margin: 0;
    border-radius: 18px;
    padding: 0 12px;
    white-space: nowrap;
  }
  .folders .compose-link { margin: 0 4px 0 0; padding: 0 16px; }
  .job-label { max-width: 12rem; }
  .jobs,
  .jobs li { display: contents; }
  .folder-empty { display: none; }
  .panel { min-height: calc(100vh - 120px); }
  .composer button { white-space: nowrap; }
  .panel h1,
  .case-line { padding-left: 16px; padding-right: 16px; }
  .thread-actions,
  .link-notice { padding-left: 16px; padding-right: 16px; }
  .reply { padding-left: 16px; padding-right: 16px; }

  .brand { width: auto; }
  .brand-sub { white-space: normal; }

  .thread-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas:
      "avatar sender when"
      "avatar subject subject";
    min-height: 0;
    padding: 8px 12px;
    row-gap: 2px;
  }

  .thread-row > .avatar { grid-area: avatar; }
  .thread-row > .sender { grid-area: sender; }
  .thread-row > .when { grid-area: when; }
  .thread-row > .subject-line { grid-area: subject; }

  /* 下書きの行と、予約のやり取りの行。顔の丸が無いので、上に題、下に書き出し。 */
  .thread-row.case-thread {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "subject"
      "when";
    padding: 10px 16px;
  }
  .thread-row.case-thread > .when {
    justify-self: start;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
  }
}

/* ログインの画面と、入れないときの知らせ。 */
.gate-box {
  max-width: 26rem;
  margin: 12vh auto 0;
  padding: 28px 28px 24px;
  background: var(--surface);
  border-radius: 16px;
}

.gate-box h1 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 400;
  color: #5f6368;
}

.gate-box button {
  height: 40px;
  padding: 0 24px;
  border: 0;
  border-radius: 20px;
  background: var(--blue);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}

.gate-box button:hover { background: var(--blue-deep); }

.gate-note {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fef7e0;
  color: #5c4300;
  font-size: 13px;
}

/* 上の帯の右端。自分のメニュー。丸を押したときだけ、名前・段階・管理・ログアウトが開く。 */
.who {
  position: relative;
  flex: none;
}

.who summary {
  display: block;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.who summary::-webkit-details-marker { display: none; }

.who summary:hover,
.who[open] summary { background: rgba(68, 71, 70, 0.12); }

.who-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #5f6368;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.who-menu {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 20;
  min-width: 12rem;
  padding: 12px 0 6px;
  border: 1px solid #c4c7c5;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 13px;
}

.who-menu p { margin: 0; padding: 0 16px; }

.who-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}

.who-role {
  padding-bottom: 10px !important;
  margin-bottom: 6px !important;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.who-menu a,
.who-menu button {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 40px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.who-menu form { margin: 0; }

.who-menu a:hover,
.who-menu button:hover { background: rgba(68, 71, 70, 0.08); }

/* 読むだけの人には、書く欄とボタンを出さない。サーバーも断る。 */
.is-readonly main form[method="post"],
.is-readonly .compose-link,
.is-readonly .link-box { display: none; }

.staff-login {
  color: var(--muted);
  font-size: 12px;
}

.staff-self { color: var(--muted); }

.staff-list select {
  height: 28px;
  border: 1px solid #c4c7c5;
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
}

/* ホーム画面に入れて開いたとき。ブラウザの枠が無いので、切り欠きとホームバーを避ける。 */
@media (display-mode: standalone) {
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
  .shell { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

@media (max-width: 760px) {
  .who { order: 3; }
  .gate-box { margin: 6vh 12px 0; }
}
