/* 承認済みのコンパクトなダーク案を本番UIへ適用する。 */
@font-face {
  font-family: "Redaction 35";
  src: url("/fonts/redaction/redaction-35-latin-400-normal.woff2")
    format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  --sidebar: 0px;
}
/* コストはスマホでも横に表を動かさず、動画名と内訳を折り返して読む。 */
.cost-controls {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 220px);
  gap: 18px;
  margin-bottom: 24px;
}
.cost-controls label { margin: 0; min-width: 0; }
.cost-controls input, .cost-controls select { margin-top: 8px; }
.cost-controls label > span { display: block; margin-top: 6px; }
.cost-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cost-card { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.cost-card-primary { background: var(--accent-soft); border-color: #334669; }
.cost-card h2 { font-size: 14px; margin: 0 0 14px; font-weight: 500; }
.cost-amount { font-size: clamp(24px, 3vw, 40px); line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cost-card-primary .cost-amount { color: #aac6ff; }
.cost-card p { margin: 10px 0 0; }
.cost-note { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 16px 0 24px; }
.cost-breakdown { border-block: 1px solid var(--line); padding: 10px 0; margin-bottom: 32px; }
.cost-breakdown > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.cost-breakdown strong { font-weight: 500; }
.cost-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cost-list-heading h2 { font-size: 17px; margin: 0; }
.cost-job { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, minmax(90px, 130px)); align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.cost-job > div { min-width: 0; overflow-wrap: anywhere; }
.cost-job-title h3 { margin: 0; font-size: 14px; line-height: 1.7; }
.cost-job-title p { margin: 6px 0 0; }
.cost-job > div:not(:first-child) { display: grid; gap: 5px; }
.cost-job strong { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cost-details { margin-top: 30px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.cost-details summary { cursor: pointer; padding-block: 10px; }
@media (min-width: 701px) and (max-width: 900px) {
  .app-header { flex-wrap: wrap; padding-block: 10px; }
  .app-header .header-tools { margin-left: auto; }
  .app-header .app-nav { order: 3; flex-basis: 100%; justify-content: center; }
}
@media (max-width: 700px) {
  #tab-costs .page-heading h1 { grid-row: 1; }
  #tab-costs .page-heading p { grid-row: 2; margin: 0; }
  #costRefresh { grid-column: 2; grid-row: 1; }
  .cost-controls { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-summary { gap: 10px; }
  .cost-card { padding: 16px 12px; }
  .cost-card h2 > span { display: block; margin-top: 4px; }
  .cost-card h2 { min-height: 40px; }
  .cost-job { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .cost-job-title { grid-column: 1 / -1; }
}
/* 小型スマホでは金額と通貨記号を途中で分断しない。 */
@media (max-width: 360px) {
  .cost-summary { grid-template-columns: minmax(0, 1fr); }
  .cost-card h2 { min-height: 0; }
  .cost-card h2 > span { display: inline; }
}
html {
  scroll-padding-top: 20px;
}
button,
input,
textarea,
select {
  border-radius: 8px;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline-color: var(--accent);
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #6798ff22;
}
button.primary:hover,
.q-actions button[data-act="review"]:hover {
  background: #ddd;
  border-color: #ddd;
  color: #101010;
}
.app-header {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
}
.app-header .brand {
  padding: 0;
  font-size: 25px;
  flex-shrink: 0;
}
.brand-mark {
  width: 25px;
  height: 28px;
  gap: 3px;
}
.brand-mark i {
  width: 5px;
  height: 22px;
  border-radius: 1px;
}
.brand-mark i:nth-child(2) {
  height: 28px;
  background: #f5f5f5;
}
.brand-mark i:nth-child(3) {
  height: 17px;
}
.app-nav {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: 22px;
  margin-left: auto;
}
.app-nav button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 0 2px;
  gap: 7px;
}
.app-nav button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.app-nav button:hover {
  color: var(--text);
}
.app-nav .icon {
  width: 15px;
  height: 15px;
}
.app-nav .badge {
  background: #1b2840;
  color: #a6c3ff;
  margin: 0;
  font-size: 10px;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-tools .icon-button {
  min-height: 36px;
}
.header-tools .who {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  padding: 5px;
}
.user-avatar {
  border-radius: 6px;
  width: 28px;
  height: 28px;
}
.connection-status i {
  background: #9dccaa;
}
.connection-status.offline i {
  background: var(--danger);
}
.app-content {
  margin-left: 0;
}
main {
  max-width: 1280px;
  padding: 28px 40px 24px;
}
.page-heading {
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
}
.page-heading h1 {
  font-size: 26px;
  font-weight: 550;
  letter-spacing: -0.03em;
  margin: 0;
}
.page-heading > .primary {
  margin: 0;
  padding: 10px 16px;
  border-radius: 8px;
  min-height: 44px;
}
.app-footer {
  max-width: 1280px;
  margin: auto;
  padding: 0 40px 24px;
}
.preview-banner {
  background: #101725;
  color: #b6c9f3;
  border-color: #29354e;
  padding: 6px 40px;
}
.preview-tag {
  color: #b6c9f3;
  border-color: #45567a;
}
.q-head {
  gap: 8px;
  margin-bottom: 20px;
}
.channel-selector {
  max-width: 320px;
}
.q-head select {
  min-height: 40px;
}
.q-head > button {
  border-radius: 6px;
}
.q-head .q-exclusions-button {
  color: #ffb0aa;
  border-color: #653936;
  background: #211514;
  gap: 6px;
}
.q-head .q-exclusions-button:hover {
  color: #ffd0cc;
  border-color: #92504b;
  background: #2b1918;
}
.q-exclusions-button b {
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #3a201e;
  color: #ffc0bb;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
}
.modal.exclusion-modal {
  width: 780px;
  padding: 0;
  overflow: hidden;
}
.exclusion-modal > * {
  margin-inline: 28px;
}
.exclusion-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-top: 26px;
}
.exclusion-heading .eyebrow {
  color: var(--danger);
}
.exclusion-heading h2 {
  margin-top: 5px;
}
.exclusion-heading > strong {
  color: var(--danger);
  font-family: "Redaction 35", var(--font);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
}
.exclusion-heading > strong small {
  margin-left: 5px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 400;
}
.exclusion-note {
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #4a302e;
  border-radius: 6px;
  background: #1c1413;
  color: #d7b2af;
  font-size: 12px;
  line-height: 1.75;
}
.exclusion-list {
  max-height: 58dvh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.exclusion-entry {
  padding: 19px 20px;
  border-bottom: 1px solid var(--line);
}
.exclusion-entry:last-child {
  border-bottom: 0;
}
.exclusion-entry header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}
.exclusion-entry h3 {
  margin: 0 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}
.exclusion-badge,
.exclusion-code {
  flex-shrink: 0;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 20px;
}
.exclusion-badge {
  padding: 0 7px;
}
.exclusion-badge.ng {
  background: #3b211f;
  color: #ffb4ae;
}
.exclusion-badge.conditional {
  background: #392d19;
  color: #e9c181;
}
.exclusion-code {
  color: var(--muted);
}
.exclusion-entry dl {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
}
.exclusion-entry dt {
  color: var(--muted);
  font-weight: 500;
}
.exclusion-entry dd {
  margin: 0;
  color: #d5d5d5;
}
.exclusion-videos {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #242424;
}
.exclusion-videos > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.exclusion-videos a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #aac6ff;
  font-size: 11px;
  line-height: 1.5;
}
.exclusion-videos a span {
  min-width: 0;
}
.exclusion-videos .icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.exclusion-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.exclusion-modal > .exclusion-footer {
  margin-inline: 0;
}
.q-stats {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 28px;
}
.q-stat,
.q-stat:last-child {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 16px 20px;
  gap: 6px;
  background: transparent;
  white-space: normal;
  outline-offset: -3px;
}
.q-stat + .q-stat {
  border-left: 1px solid var(--line);
}
.q-stat:hover {
  background: #1c1c1c;
}
.q-stat.attention {
  background: #141c2a;
}
.q-stat.attention:hover {
  background: #1b2840;
}
.q-stat.attention .k,
.q-stat.attention .v {
  color: #aac6ff;
}
.q-stat.attention b {
  color: var(--accent);
}
.q-stat:disabled {
  opacity: 0.7;
}
.q-stat .k {
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.q-stat .k .icon {
  display: block;
  color: var(--accent);
  width: 15px;
  height: 15px;
}
.q-stat b,
.q-stat:last-child b {
  font-family: "Redaction 35", Georgia, serif;
  font-size: 48px;
  font-weight: 400;
  font-synthesis: none;
  font-variant-numeric: normal;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0;
}
.q-stat b small {
  font: 11px var(--font);
  color: var(--muted);
  margin-left: 8px;
}
.q-stat .v {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}
.q-stat .v .icon {
  width: 13px;
  height: 13px;
}
.library-layout {
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 28px;
}
.library-browser {
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
  overflow: visible;
  margin: 0;
}
.library-toolbar {
  margin-bottom: 16px;
}
.library-toolbar h2 {
  font-size: 18px;
  font-weight: 500;
}
/* 一覧に出る動画の条件。普段は 1 行、開いたときだけ箇条書き */
.library-rules {
  margin-top: 6px;
  line-height: 1.7;
}
.library-rules summary {
  cursor: pointer;
  width: fit-content;
}
.library-rules ul {
  margin: 4px 0 0;
  padding-left: 1.4em;
}
.library-rules li {
  margin: 0;
}
.count-pill {
  border: 1px solid #333;
  background: transparent;
  border-radius: 4px;
  font-size: 11px;
}
.library-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.library-controls .search-field {
  flex: 1;
  max-width: none;
  width: auto;
  margin: 0;
  border-radius: 8px;
  min-width: 0;
}
.library-controls .search-field input {
  min-height: 44px;
}
.library-controls .sort-control {
  min-width: 0;
}
.library-controls .sort-control > [data-icon] {
  display: none;
}
.library-controls select {
  max-width: 172px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 8px;
  border-radius: 8px;
}
.filters {
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  margin-top: 12px;
}
.filters button {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 0;
  min-height: 44px;
}
.filters button.active {
  background: transparent;
  border-bottom-color: var(--accent);
  color: var(--text);
}
.filters button.active .filter-count {
  color: var(--accent);
}
.q-items {
  margin-top: 16px;
}
.q-group {
  margin: 20px 0 2px;
  font-size: 11px;
}
.q-row {
  background: transparent;
  grid-template-columns: 90px minmax(0, 1fr) 150px;
  gap: 10px 16px;
  padding: 18px 0;
  align-items: center;
}
.q-thumb {
  width: 90px;
  border-radius: 4px;
}
.q-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.q-side {
  grid-column: 3;
  grid-row: 1;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.q-status,
.q-status.work,
.q-status.ready,
.q-status.done,
.q-status.bad,
.q-status.idle {
  background: transparent;
  padding: 0;
}
.q-status.ready,
.q-status.work {
  color: var(--accent);
}
.q-actions button {
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 11px;
  min-height: 34px;
}
.q-actions button[data-act="review"] {
  background: #f5f5f5;
  color: #101010;
}
.q-actions .q-more {
  width: 28px;
  min-width: 28px;
}
.q-prog {
  grid-column: 2 / -1;
}
.q-clips {
  grid-column: 1 / -1;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.q-clip {
  background: #1b1b1b;
  border-color: #333;
  border-radius: 6px;
}
.q-clip-info label {
  color: var(--text);
}
.q-toggle {
  color: var(--muted) !important;
}
.schedule-card,
.automation-card {
  border-radius: 8px;
  padding: 20px;
  background: #121212;
}
.library-rail .card {
  border-radius: 8px;
}
.schedule-date {
  border-radius: 5px;
}
.schedule-card > p {
  margin-bottom: 18px;
}
.automation-toggle {
  border: 0;
  padding-top: 0;
}
.automation-description {
  margin-bottom: 0;
}
.switch:after {
  background: #aaa;
}
.switch:checked {
  background: #213962;
}
.switch:checked:after {
  background: var(--accent);
}
/* 自動幅のグリッド列が固定幅ダイアログに押し広げられないようにする。 */
.modal-bg {
  grid-template-columns: minmax(0, 1fr);
}
.modal {
  min-width: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
.booking-modal .booking-fields {
  display: grid;
  gap: 12px;
  max-height: min(52vh, 460px);
  overflow-y: auto;
  margin: 18px 0;
}
.booking-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 230px);
  align-items: center;
  gap: 14px;
}
.booking-field span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.booking-field input {
  min-width: 0;
  width: 100%;
}
@media (max-width: 600px) {
  .booking-field { grid-template-columns: 1fr; gap: 6px; }
}
/* 時刻欄が行幅を使い切ると削除ボタンがはみ出すため、残り幅に収める。 */
.q-time input[type="time"] {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}
.q-time-del {
  flex: 0 0 auto;
}
.card,
.job,
.modal,
.preset-list,
.preset-editor,
.drop,
.seg,
.rv-row,
.menu {
  border-radius: 8px;
}
.seg button,
.preset-list li,
.format-badge,
.step-heading > span {
  border-radius: 6px;
}
.seg button.active {
  background: #24324a;
  color: #d7e4ff;
}
.preset-actions {
  background: #141414f2;
}
.create-card {
  padding: 24px;
}
.create-guide {
  padding-top: 4px;
}
.create-guide > h3 {
  font-size: 14px;
}
.jobs-toolbar .filters {
  margin-top: 0;
}
.center-screen {
  grid-template-columns: minmax(0, 1fr);
}
.login-card {
  width: 100%;
  min-width: 0;
  max-width: 420px;
}
.login-card h1 {
  font-size: 26px;
  letter-spacing: -0.03em;
  margin: 24px 0 12px;
}
.google-btn {
  background: var(--panel-2);
  color: var(--text);
  border-color: #454545;
  border-radius: 8px;
}
.search-field:focus-within {
  border-color: var(--accent);
}
@media (max-width: 1100px) {
  .app-header {
    padding-inline: 28px;
    gap: 20px;
  }
  .connection-status {
    display: none;
  }
  main {
    padding-inline: 28px;
  }
  .q-stat,
  .q-stat:last-child {
    padding: 16px;
  }
  .q-stat .k {
    font-size: 11px;
  }
  .library-layout {
    grid-template-columns: minmax(0, 1fr) 255px;
    gap: 24px;
  }
  .library-rail {
    grid-template-columns: minmax(0, 1fr);
  }
  .q-row {
    grid-template-columns: 80px minmax(0, 1fr);
  }
  .q-thumb {
    width: 80px;
  }
  .q-side {
    grid-column: 2;
    grid-row: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
@media (max-width: 900px) {
  .library-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .library-rail {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .app-nav {
    gap: 15px;
  }
  .header-tools {
    gap: 4px;
  }
  .header-tools .who {
    max-width: 80px;
  }
  .header-tools .user-avatar {
    display: none;
  }
}
@media (max-width: 700px) {
  .app-header {
    height: 56px;
    min-height: 56px;
    padding: 0 16px;
    gap: 12px;
  }
  .app-header .brand {
    font-size: 21px;
  }
  .header-tools {
    margin-left: auto;
  }
  .header-tools .who {
    font-size: 11px;
    min-height: 44px;
  }
  .header-tools .icon-button {
    min-height: 44px;
  }
  .app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #111111f5;
    backdrop-filter: blur(12px);
    border-top: 1px solid #333;
  }
  .app-nav button {
    flex-direction: column;
    position: relative;
    border: 0;
    border-radius: 6px;
    min-height: 47px;
    gap: 5px;
    font-size: 10px;
    padding: 4px;
  }
  .app-nav button.active {
    background: #192131;
    color: var(--accent);
  }
  .app-nav .icon {
    width: 18px;
    height: 18px;
  }
  .app-nav .badge {
    position: absolute;
    top: 0;
    right: 12%;
    min-width: 16px;
    line-height: 16px;
  }
  main {
    padding: 20px 16px 16px;
  }
  .page-heading {
    margin-bottom: 16px;
    align-items: center;
    gap: 10px;
  }
  .page-heading h1 {
    font-size: 21px;
    margin: 0;
  }
  .page-heading > .primary {
    padding: 10px;
    margin: 0;
    min-height: 44px;
    font-size: 12px;
  }
  .desktop-action-label {
    display: inline;
  }
  .mobile-action-label {
    display: none;
  }
  .q-head {
    flex-wrap: wrap;
    margin-bottom: 16px;
    gap: 6px;
  }
  .q-head .channel-selector {
    flex: 1;
    width: auto;
    min-width: 100px;
    max-width: none;
  }
  .q-head #qUpdated {
    display: none;
  }
  .q-head > .grow {
    display: none;
  }
  .q-head #qAdd {
    width: 36px;
    padding: 8px;
    font-size: 0;
    gap: 0;
  }
  .q-head #qRefresh {
    width: 36px;
    padding: 8px;
    font-size: 0;
    gap: 0;
  }
  .q-head .q-exclusions-button {
    padding-inline: 9px;
  }
  .q-exclusions-label {
    display: none;
  }
  .exclusion-modal > * {
    margin-inline: 16px;
  }
  .exclusion-heading {
    padding-top: 20px;
  }
  .exclusion-heading > strong {
    font-size: 34px;
  }
  .exclusion-list {
    max-height: 60dvh;
  }
  .exclusion-entry {
    padding: 16px;
  }
  .exclusion-entry header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .exclusion-entry h3 {
    flex-basis: 100%;
    margin: 2px 0 0;
  }
  .exclusion-entry dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .exclusion-entry dd + dt {
    margin-top: 7px;
  }
  .exclusion-footer {
    margin: 0;
    padding: 13px 16px;
  }
  .q-head .icon {
    width: 16px;
    height: 16px;
  }
  .q-head > button {
    min-height: 44px;
  }
  .q-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 24px;
  }
  .q-stat,
  .q-stat:last-child {
    padding: 12px 14px;
    gap: 4px;
  }
  .q-stat:nth-child(3) {
    border-left: 0;
  }
  .q-stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .q-stat .k {
    font-size: 11px;
    gap: 6px;
  }
  .q-stat .k .icon {
    width: 14px;
    height: 14px;
  }
  .q-stat b,
  .q-stat:last-child b {
    font-size: 42px;
  }
  .q-stat .v {
    font-size: 10px;
  }
  .q-stat .v .icon {
    width: 12px;
    height: 12px;
  }
  .library-toolbar {
    margin-bottom: 12px;
  }
  .library-toolbar h2 {
    font-size: 16px;
  }
  .library-controls {
    gap: 8px;
    flex-wrap: wrap;
  }
  .library-controls .search-field {
    flex-basis: calc(100% - 144px);
  }
  .library-controls .sort-control {
    flex: 0 0 136px;
  }
  .library-controls input,
  .library-controls select {
    font-size: 16px;
    min-height: 46px;
  }
  .library-controls select {
    width: 100%;
    max-width: none;
  }
  .library-controls #qClear {
    margin-left: auto;
  }
  .filters {
    gap: 20px;
    margin-top: 4px;
    margin-right: -16px;
    padding-right: 16px;
  }
  .filters button {
    font-size: 12px;
    min-height: 48px;
    padding: 12px 0;
  }
  .q-items {
    margin-top: 12px;
  }
  .q-row {
    grid-template-columns: 86px minmax(0, 1fr);
    padding: 16px 0;
    gap: 10px 13px;
  }
  .q-thumb {
    width: 86px;
    aspect-ratio: 4/3;
  }
  .q-title {
    font-size: 13px;
  }
  .q-side {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
  }
  .q-actions button {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .q-actions .q-more {
    min-width: 36px;
    width: 36px;
    padding: 5px;
  }
  .q-clips {
    padding: 12px;
  }
  .q-clip-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .library-rail {
    grid-template-columns: minmax(0, 1fr);
  }
  .create-card {
    padding: 18px;
  }
  .app-footer {
    padding: 12px 16px calc(100px + env(safe-area-inset-bottom, 0px));
  }
  .preview-banner {
    padding-inline: 16px;
  }
  .format-badge {
    display: none;
  }
}
@media (max-width: 360px) {
  .page-heading h1 {
    font-size: 19px;
  }
  .page-heading > .primary {
    font-size: 11px;
    padding-inline: 8px;
  }
  .q-stat,
  .q-stat:last-child {
    padding-inline: 11px;
  }
  .q-stat .k {
    font-size: 10px;
    gap: 5px;
  }
}
.selection-hint {
  margin: 8px 0 18px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
#selectionMode, #qsSelectionMode {
  max-width: 100%;
  min-width: 0;
}

.q-selection-hint { grid-column: 1 / -1; margin: 0; }

/* 単発クリップは、動画を開く場所と投稿操作を分けて読みやすくする。 */
.standalone-library {
  padding: 24px;
  background: #111;
  border-color: #343434;
}
.standalone-library h3 {
  margin: 0 0 20px;
  font-size: 18px;
  line-height: 1.5;
}
.standalone-job {
  margin: 0;
  padding: 20px 0 24px;
  border-top: 1px solid #303030;
}
.standalone-job:last-child { padding-bottom: 0; }
.standalone-job-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.standalone-job-heading > b {
  min-width: 0;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.standalone-job-heading .standalone-job-meta {
  grid-column: 1;
  font-size: 12px;
}
.standalone-job-heading .standalone-schedule-all {
  grid-column: 2;
  grid-row: 1 / 3;
  white-space: nowrap;
  min-height: 40px;
  color: #dbe8ff;
  border-color: #5276af;
}
.standalone-job .q-clip-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 14px;
}
.standalone-clip {
  min-width: 0;
  padding: 12px;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: #1c1c1c;
}
.standalone-open {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.standalone-open:hover .standalone-poster,
.standalone-open:focus-visible .standalone-poster { outline: 2px solid #8bb4ff; outline-offset: 2px; }
.standalone-poster {
  position: relative;
  display: block;
  width: 104px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background: #080808;
}
.standalone-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.standalone-play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding-left: 3px;
  border-radius: 50%;
  background: #000b;
  color: #fff;
  font-size: 18px;
  transform: translate(-50%, -50%);
}
.standalone-details { display: grid; gap: 10px; min-width: 0; padding-top: 3px; }
.standalone-details b { font-size: 14px; line-height: 1.55; white-space: normal; overflow-wrap: anywhere; }
.standalone-details small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.standalone-open-hint { color: #a9c7ff; font-size: 12px; font-weight: 600; }
.standalone-clip-footer {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #353535;
  font-size: 12px;
}
.standalone-clip-footer a { color: #9ec1ff; }
.standalone-clip-footer .standalone-schedule {
  margin-left: auto;
  min-height: 38px;
  padding: 8px 14px;
  color: #e9f1ff;
  background: #294a7c;
  border-color: #446da8;
  font-size: 12px;
  font-weight: 600;
}
.standalone-status { color: var(--muted); }
.standalone-status.bad { color: #ffadad; }

.standalone-viewer[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: #080808;
  color: #fff;
}
.standalone-viewer::backdrop { background: #000e; }
.standalone-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1000px;
}
.standalone-viewer-bar h2 { margin: 0; font-size: 16px; line-height: 1.5; }
.standalone-viewer-close { flex: none; min-height: 42px; padding: 8px 14px; }
.standalone-viewer video {
  display: block;
  flex: 1;
  width: 100%;
  max-width: 1000px;
  min-height: 0;
  background: #000;
  object-fit: contain;
}
@media (max-width: 700px) {
  .standalone-library { padding: 16px; }
  .standalone-job-heading { grid-template-columns: minmax(0, 1fr); }
  .standalone-job-heading .standalone-schedule-all { grid-column: 1; grid-row: auto; justify-self: start; }
  .standalone-job .q-clip-grid { grid-template-columns: minmax(0, 1fr); }
  .standalone-open { grid-template-columns: 90px minmax(0, 1fr); }
  .standalone-poster { width: 90px; }
  .standalone-viewer-bar h2 { font-size: 14px; }
}

/* 媒体別の予約状態はクリップ・予約のすぐ下に置く。 */
.social-status { display: block; margin-top: 4px; font-size: 11px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.q-book-title:has(.social-status) { white-space: normal; }

/* 予約の選択欄を日時に揃え、操作ボタンが行幅まで広がらないようにする。 */
.q-book { align-items: start; }
.q-book-check { align-self: start; padding-top: 2px; }
.q-book-check input,
.q-book-actions input { margin: 0; flex: none; }
.q-book-title { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; }
.q-book-state { min-width: 0; overflow-wrap: anywhere; line-height: 1.6; }
.q-book > button { justify-self: end; width: auto; }
@media (max-width: 700px) {
  .q-booked { padding: 16px; }
  .q-book {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 6px 10px;
    padding: 16px 0;
  }
  .q-book-check { grid-column: 1; grid-row: 1; padding-top: 0; align-self: center; }
  .q-book-check input,
  .q-book-actions input { width: 20px; height: 20px; min-height: 0; padding: 0; }
  .q-book-at { grid-column: 2; grid-row: 1; line-height: 24px; }
  .q-book-title { grid-column: 2; grid-row: 2; }
  .q-book-state { grid-column: 2; grid-row: 3; }
  .q-book > button { grid-column: 2; grid-row: 4; min-height: 40px; padding: 8px 12px; margin-top: 2px; border: 1px solid var(--line); }
  .q-book-actions { gap: 8px 12px; }
  .q-book-actions label { width: 100%; min-height: 36px; }
  .q-book-actions button { min-height: 40px; }
}
/* スマホでも引き継いだ開始・終了時刻と見出しを全文確認できるようにする。 */
@media (max-width: 600px) {
  #manualFields .grid3 { grid-template-columns: minmax(0, 1fr); }
}

.montage-range { display: flex; align-items: start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #333; }
#manualFields .montage-range input { width: 20px; height: 20px; flex: 0 0 20px; }
.montage-range span { min-width: 0; }
.montage-range small { display: block; margin-top: 5px; color: #aaa; }
#manualFields:has(#montageFields:not([hidden])) .grid3 { grid-template-columns: minmax(0, 1fr); }
