:root{
  --bg:#f7f8fa;
  --card:#ffffff;
  --text:#1c1f23;
  --muted:#6b7280;
  --line:#e6e8ee;

  --accent:#19b49a;
  --success:#1aa36f;
  --error:#e1524a;
  --warn:#d89b1d;
  --info:#2c7be5;

  --radius:14px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans JP", "Hiragino Sans", "Helvetica", Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

.container{
  width:min(980px, calc(100% - 28px));
  margin:0 auto;
}

.topbar{
  position:sticky;
  top:0;
  background:rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}

.topbar-inner{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px 0;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  white-space:nowrap;
}
.brand-link{
  display:inline-flex;
  align-items:center;
  text-decoration:none;
  line-height:0;
}
.brand-logo{
  display:block;
  height:56px;
  width:auto;
}
.brand-sub{
  color:var(--muted);
  font-size:12px;
}

.nav{
  display:flex;
  align-items:center;
  gap:8px;
  flex:1;
  justify-content:center;
  flex-wrap: nowrap;      /* 折り返さない */
  /*        入り切らない場合は横スクロール */
  white-space: nowrap;    /* テキストの改行防止 */
}
.nav-link{
  text-decoration:none;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  padding:8px 10px;
  border-radius:999px;
  flex: 0 0 auto;         /* 各リンクを縮めすぎない */
}
.nav-link:hover{
  background:#fff;
  border:1px solid var(--line);
  color:var(--text);
}
.is-disabled{
  pointer-events:none;
  opacity:0.55;
}

.header-meta{
  display:flex;
  align-items:center;
  gap:10px;
  white-space:nowrap;
}
.meta-item{
  display:flex;
  align-items:baseline;
  gap:8px;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
}
.meta-label{
  font-size:11px;
  color:var(--muted);
}
.meta-value{
  font-size:13px;
  font-weight:700;
}

main{
  padding:18px 0 40px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:18px;
  box-shadow: 0 10px 28px rgba(16,24,40,0.06);
}

.h1{
  margin:0 0 10px;
  font-size:20px;
}
.muted{ color:var(--muted); }

.actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin-top:14px;
}

.actions > form{
  margin:0;
  display:flex;
  align-items:center;
}

.btn{
  appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1;
  border:1px solid transparent;
  background:var(--accent);
  color:white;
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  cursor:pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}
.btn:hover{ filter:brightness(0.98); }
.btn:active{ transform: translateY(1px); }
.btn:focus-visible{
  outline:none;
  box-shadow: 0 0 0 4px rgba(25, 180, 154, 0.14);
  border-color: rgba(25, 180, 154, 0.65);
}
.btn-sm{
  padding:6px 10px;
  border-radius:10px;
  font-size:12px;
}
.btn-ghost{
  background:#fff;
  color:var(--text);
  border-color:var(--line);
}
.btn-outline{
  background:transparent;
  color:var(--accent);
  border-color:var(--accent);
}
.btn-outline:hover{
  background:rgba(25,180,154,0.08);
}
.btn-danger{
  background:#fff;
  color:var(--error);
  border-color:var(--error);
}
.btn-danger:hover{
  background:rgba(225,82,74,0.08);
}

.flash-stack{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:14px;
}

.flash{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:12px 14px;
  box-shadow: 0 10px 22px rgba(16,24,40,0.05);
}

.flash-success{ border-left:5px solid var(--success); }
.flash-error{ border-left:5px solid var(--error); }
.flash-validation{ border-left:5px solid var(--warn); }
.flash-async{ border-left:5px solid var(--info); }

.flash-message{
  display:block;
  font-weight:700;
  font-size:13px;
}

code{
  background:#f2f4f8;
  border:1px solid var(--line);
  padding:2px 6px;
  border-radius:8px;
}


/* TASK-013 header 2-row */
.topbar-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

/* 2段目のナビは左寄せで1行固定 */
.nav-row{
  justify-content:flex-start;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ---- form controls ---- */
.form{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.form-group{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.form-label{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
}

.input{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  color:var(--text);
  font-size:13px;
  outline:none;
}

.input:focus{
  border-color: rgba(25, 180, 154, 0.6);
  box-shadow: 0 0 0 4px rgba(25, 180, 154, 0.12);
}

.help{
  font-size:12px;
  color:var(--muted);
  margin:0 0 14px;
}

.auth-card{
  max-width:520px;
  margin:0 auto;
}
/* ---- /me ---- */
.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}
@media (max-width: 860px){
  .grid-2{ grid-template-columns: 1fr; }
}

.subcard{
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:14px;
}

.h2{
  margin:0 0 10px;
  font-size:15px;
}

.h3{
  margin:0 0 8px;
  font-size:13px;
  font-weight:800;
  color:var(--muted);
}

.kv{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.kv-row{
  display:flex;
  gap:10px;
  /* 値が長い（コメント等）場合にズレないように上揃え */
  align-items:flex-start;
}
.kv-k{
  width:120px;
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  flex: 0 0 120px;
}
.kv-v{
  font-size:13px;
  font-weight:700;
  flex: 1 1 auto;
  min-width: 0;
  /* 日本語が不自然に1文字改行されないようにしつつ、長文は自然に折り返す */
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

/* =========================================================
   TASK-015: Workspaces UI helpers
   - table / select / badge / divider
   ========================================================= */

/* ---- divider ---- */
hr{
  border:0;
  border-top:1px solid var(--line);
  margin:14px 0;
}

/* ---- select ---- */
.select{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  color:var(--text);
  font-size:13px;
  outline:none;
  cursor:pointer;
}

.select:focus{
  border-color: rgba(25, 180, 154, 0.6);
  box-shadow: 0 0 0 4px rgba(25, 180, 154, 0.12);
}

/* フォームが横並びのとき、inputだけ広がりすぎないように */
.actions .input{
  min-width: 220px;
  flex: 1 1 260px;
}
.actions .select{
  flex: 0 0 auto;
}

/* 横並びフォーム：ラベルをプルダウンの外に置く */
.filter-inline{
  display:inline-flex;
  align-items:center;
  gap:8px;
  flex: 0 0 auto;
}
.filter-inline .form-label{
  margin:0;
  flex-shrink:0;
}

/* ---- table ---- */
.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size:13px;
  margin-top:10px;
  border:1px solid var(--line);
  border-radius: var(--radius);
  overflow:hidden;
  background:#fff;
}

.table thead th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  padding:12px 12px;
  background:#fbfcfe;
  border-bottom:1px solid var(--line);
  white-space: nowrap;
}

.table tbody th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  padding:12px 12px;
  background:#fbfcfe;
  border-bottom:1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}

.table tbody td{
  text-align:left;
  padding:12px 12px;
  border-bottom:1px solid var(--line);
  vertical-align: middle;
}

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

/* 行ホバーで視認性UP */
.table tbody tr:hover td{
  background:#f5f7fa;
  transition: background-color 0.15s ease;
}

/* 右寄せセルがある場合 */
.table td[style*="text-align:right"]{
  white-space: nowrap;
}

/* スマホ幅ではテーブルが横に溢れるのでスクロール */
@media (max-width: 860px){
  .table{
    display:block;
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- badge ---- */
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(26, 163, 111, 0.28);
  background: rgba(26, 163, 111, 0.10);
  color: #0f6b48;
  font-size:12px;
  font-weight:800;
  line-height:1;
  white-space: nowrap;
}

.badge-muted{
  border-color: rgba(107, 114, 128, 0.25);
  background: rgba(107, 114, 128, 0.10);
  color: #4b5563;
}

.badge-danger{
  border-color: rgba(225, 82, 74, 0.35);
  background: rgba(225, 82, 74, 0.10);
  color: #b42318;
}

.badge-warn{
  border-color: rgba(216, 155, 29, 0.35);
  background: rgba(216, 155, 29, 0.12);
  color: #8a5a00;
}

.badge-plan--free{
  border-color: rgba(107, 114, 128, 0.28);
  background: rgba(107, 114, 128, 0.10);
  color: #4b5563;
}

.badge-plan--paid{
  border-color: rgba(25, 180, 154, 0.32);
  background: rgba(25, 180, 154, 0.12);
  color: #0f766e;
}

.plan-badge-note{
  margin-top:6px;
  font-size:12px;
  line-height:1.5;
}

/* ---- nicer btn-ghost hover ---- */
.btn-ghost:hover{
  background:#fbfcfe;
}

/* ---- nicer "back" button ---- */
.btn-back{
  padding:10px 10px;
}
.btn-back .btn-icon{
  width:20px;
  height:20px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: rgba(25, 180, 154, 0.10);
  color: var(--accent);
  font-weight:900;
  flex: 0 0 auto;
}
.btn-back .btn-icon svg{
  display:block;
}
.btn-back:hover{
  border-color: rgba(25, 180, 154, 0.55);
}

/* ---- TASK-016: workspace form/list UI additions ---- */
.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.page-head__row{
  width:100%;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.actions--head{
  justify-content:flex-end;
}

.filters{
  display:flex;
  gap:10px;
  align-items:center;
  margin:10px 0 14px;
}
@media (max-width: 860px){
  .filters{ flex-direction:column; align-items:stretch; }
}

.req{
  display:inline-flex;
  margin-left:6px;
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  border:1px solid var(--line);
  background:#fff;
  color:var(--muted);
}

.check{
  display:flex;
  gap:10px;
  align-items:center;
  font-weight:800;
  font-size:13px;
}
.check input{ width:16px; height:16px; }

.table .btn{ padding:8px 10px; border-radius:10px; }

.table td .muted{ line-height: 1.4; }

/* テンプレート一覧の改善 */
.table tbody tr {
  transition: background-color 0.15s ease;
}

.table tbody td {
  /* テーブル全体に break-word を掛けると、日本語が1文字改行され縦長表示になることがある */
  word-break: normal;
  overflow-wrap: normal;
}

.table tbody td[style*="text-align: center"] {
  vertical-align: middle;
}

/* ========== テンプレート一覧専用 ========== */
.filters-wrap{
  background:#fafbfc;
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px 16px;
  margin-bottom:18px;
}
.filters-wrap .filters{
  margin:0;
  align-items:flex-end;
}
.filters--templates{
  flex-wrap: wrap;
}
.filters--templates .form-group--sm{
  min-width: 160px;
  flex: 1 1 160px;
  max-width: 240px;
}
.filters--templates .form-group--compact{
  max-width: 160px;
}
.filters--templates .form-group--wide{
  flex: 1 1 320px;
  max-width: none;
}
.filters--templates .form-group--wide .select{
  width: 100%;
}
.filters-row-2{
  flex: 1 1 100%;
  display:grid;
  grid-template-columns: 1fr auto; /* 2列固定: 左=プルダウン群 / 右=ボタン群 */
  gap:10px;
  align-items:flex-end;
}
.filters-row-2__controls{
  display:flex;
  flex-wrap: nowrap;
  gap:10px;
  align-items:flex-end;
  min-width: 0;
}
.form-group--compact{
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
}
.filters--templates .form-group--compact .form-label{
  font-size: 11px;
  letter-spacing: .1px;
}
.select--compact{
  width: auto;
  min-width: 64px;
  padding-right: 30px;
}
.filters--templates #activeSelect.select--compact{ width: 120px; }
.filters--templates #orderBySelect.select--compact{ width: 120px; }
.filters--templates #directionSelect.select--compact{ width: 96px; }
.filters-actions--row2{
  margin-left: auto;
  display:flex;
  flex-wrap: wrap;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  max-width: 100%;
}
.filters-actions--row2 .btn{
  white-space: nowrap;
}
.filters--templates .filters-actions{
  margin-left: auto;
}
.filters-wrap .form-group--sm{
  min-width:200px;
}
.filters-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-shrink:0;
}
@media (max-width: 860px){
  .filters-wrap .filters{ align-items:stretch; }
  .filters-wrap .form-group--sm{ min-width:auto; }
  .filters--templates .filters-actions{
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  .filters-row-2{
    grid-template-columns: 1fr;
  }
  .filters-row-2__controls{
    flex-wrap: wrap;
  }
  .filters-actions--row2{
    flex-wrap: wrap;
    margin-left: 0;
    justify-content:flex-start;
  }
}

/* 実行履歴：1行目にフィルター項目5つ、2行目に絞り込み・クリアのみ */
.filters-wrap--runs .filters{ flex-wrap: wrap; }
.filters-wrap--runs .form-group--sm{ min-width: 100px; flex: 1 1 0; max-width: 180px; }
.filters-wrap--runs .filters-actions{ flex-basis: 100%; }

/* スタッフ一覧：PCでは絞り込みを1行に収める */
.filters--staff{
  flex-wrap: nowrap;
  align-items: center;
}
.filters--staff .input{
  flex: 1 1 auto;
  min-width: 0;
}
.filters--staff .select{
  flex: 0 0 170px;
}
.filters--staff .btn{
  flex: 0 0 auto;
}
@media (max-width: 860px){
  .filters--staff{
    flex-wrap: wrap;
    align-items: stretch;
  }
  .filters--staff .select{
    flex: 1 1 auto;
  }
}

/* スタッフ一覧テーブル */
.table--staff{
  width:100%;
  table-layout:fixed;
}
.table--staff .col-name{ width:auto; }
.table--staff .col-status{
  width:96px;
  text-align:center;
}
.table--staff .col-daily-limit{
  width:112px;
  text-align:center;
}
.table--staff .col-staff-code{
  width:28%;
}
.table--staff .col-actions{
  width:112px;
  text-align:right;
}
.table--staff .cell-status,
.table--staff .cell-daily-limit{
  text-align:center;
}
.table--staff .cell-daily-limit{
  font-variant-numeric: tabular-nums;
  font-weight:600;
}
.table--staff .cell-staff-code code{
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.table--staff .cell-actions{
  text-align:right;
  white-space:nowrap;
}

.staff-limit-panel{
  margin:16px 0 4px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:linear-gradient(135deg, #ffffff 0%, #f7fafb 100%);
  box-shadow:0 8px 24px rgba(16,24,40,0.04);
}
.staff-limit-panel__head{
  margin-bottom:12px;
}
.staff-limit-panel__title{
  font-size:12px;
  font-weight:800;
  letter-spacing:0.08em;
  color:var(--muted);
}
.staff-limit-panel__grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.staff-limit-card{
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}
.staff-limit-card__label{
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
  margin-bottom:8px;
}
.staff-limit-card__value{
  display:flex;
  align-items:baseline;
  gap:4px;
  margin-bottom:10px;
}
.staff-limit-card__count{
  font-size:28px;
  font-weight:800;
  font-variant-numeric:tabular-nums;
  color:var(--text);
  line-height:1;
}
.staff-limit-card__sep{
  font-size:18px;
  font-weight:600;
  color:#c5cad3;
}
.staff-limit-card__limit{
  font-size:15px;
  font-weight:700;
  color:var(--muted);
}
.staff-limit-card__bar{
  height:6px;
  border-radius:999px;
  background:#eef1f5;
  overflow:hidden;
}
.staff-limit-card__bar-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, var(--accent), #3dd4b8);
}
.staff-limit-card--lmd .staff-limit-card__bar-fill{
  background:linear-gradient(90deg, #5b8def, #7aa8f5);
}
.staff-limit-card--full .staff-limit-card__count{
  color:var(--warn);
}
.staff-limit-card--full .staff-limit-card__bar-fill{
  background:linear-gradient(90deg, var(--warn), #e8b84a);
}

@media (max-width: 720px){
  .staff-limit-panel__grid{
    grid-template-columns:1fr;
  }
}

/* 日付入力：プレースホルダー「年/月/日」＋カレンダーアイコンで選択可能であることを明示 */
.filters-wrap--runs .date-input-wrap {
  position: relative;
}
.filters-wrap--runs .date-input-wrap .date-input-display {
  width: 100%;
  padding-right: 36px;
}
.filters-wrap--runs .date-input-wrap .date-input-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}
.filters-wrap--runs .date-input-wrap .date-input-icon svg {
  display: block;
}
.filters-wrap--runs .date-input-wrap .date-input-picker {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

.empty-state{
  text-align:center;
  padding:32px 20px;
}
.empty-state .muted{ font-size:14px; }

.table-wrap{
  margin-top:4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table--templates{
  /* 列数が多いので、横スクロール前提で詰め込みすぎない */
  table-layout:auto;
  width:max-content;
  min-width: 1320px;
}

/* テンプレート一覧（必要項目のみ表示）: 画面内に収めてスクロールさせない */
.table--templates-compact{
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.table--templates .col-thumb{ width:88px; text-align:center; }
.table--templates .col-staff{ width:12%; }
.table--templates .col-active{ width:90px; text-align:center; }
.table--templates .col-menu{ width:11%; }
.table--templates .col-categories{ width:18%; }
.table--templates .col-comment{ width:14%; }
.table--templates .col-sort{ width:72px; text-align:center; }
.table--templates .col-date{ width:120px; }
.table--templates .col-id{ width:64px; }
.table--templates .col-actions{ width:120px; text-align:right; }
.table--templates .col-actions--with-delete{ min-width:280px; width:auto; }

.table--templates .cell-thumb{
  text-align:center;
  padding:10px 8px;
  vertical-align:middle;
}
.table--templates .thumb-img{
  width:56px;
  height:56px;
  border-radius:10px;
  border:1px solid var(--line);
  object-fit:cover;
  background:#fbfcfe;
  display:block;
  margin:0 auto;
}
.table--templates .thumb-placeholder{
  width:56px;
  height:56px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#f0f2f5;
  margin:0 auto;
  display:block;
}
.table--templates .cell-staff{ font-weight:600; }
.table--templates .cell-active{ text-align:center; vertical-align:middle; }
.table--templates .cell-menu{ font-weight:500; }
.table--templates .cell-staff,
.table--templates .cell-menu,
.table--templates .cell-last-minute-discount{
  white-space: nowrap;
}
.table--templates .cell-categories,
.table--templates .cell-comment{
  max-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.table--templates .cell-truncate{ cursor:help; }
.table--templates .cell-empty{ font-style:italic; color:var(--muted); }
.table--templates .cell-sort{ text-align:center; color:var(--text); }
.table--templates .cell-date{ font-size:12px; white-space:nowrap; }
.table--templates .cell-actions{
  white-space:nowrap;
  vertical-align:middle;
  text-align:right;
}
.table--templates .cell-id{
  font-size:12px;
  color:var(--muted);
}

/* ========== 実行履歴（Run一覧）専用 ========== */
.table--runs{ width:100%; }
.table--runs .col-id{ width:80px; }
.table--runs .col-date{ width:120px; }
.table--runs .col-type{ width:90px; }
.table--runs .col-status{ width:100px; }
.table--runs .col-num{ width:80px; text-align:right; }
.table--runs .col-created{ width:140px; }
.table--runs .cell-id{ white-space:nowrap; }
.table--runs .link-run-id{
  text-decoration:none;
  color:var(--accent);
  font-weight:600;
}
.table--runs .link-run-id:hover{ text-decoration:underline; }
.table--runs .cell-date,
.table--runs .cell-type,
.table--runs .cell-status{ white-space:nowrap; }
.table--runs .cell-num{ text-align:right; white-space:nowrap; }
.table--runs .cell-created{ font-size:12px; white-space:nowrap; }

.table--run-items{
  table-layout:fixed;
  width:100%;
  min-width:0;
}
.table--run-items .col-order{ width:52px; }
.table--run-items .col-job{ width:96px; }
.table--run-items .col-status{ width:72px; }
.table--run-items .col-staff{ width:14%; }
.table--run-items .col-template{ width:72px; }
.table--run-items .col-datetime{ width:128px; }
.table--run-items .col-elapsed{ width:72px; }
.table--run-items .col-artifacts{ width:72px; }
.table--run-items .col-error{ width:auto; }
.table--run-items .cell-order,
.table--run-items .cell-job,
.table--run-items .cell-status,
.table--run-items .cell-template,
.table--run-items .cell-elapsed,
.table--run-items .cell-artifacts{
  white-space:nowrap;
}
.table--run-items .cell-staff{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.table--run-items .cell-datetime{
  font-size:12px;
  white-space:nowrap;
}
.table--run-items .cell-error{
  word-break:break-word;
  white-space:normal;
  font-size:12px;
  line-height:1.4;
}

/* =========================================================
   HOME-001 ダッシュボード
   ========================================================= */
   .dashboard-grid{
    display:grid;
    grid-template-columns: 1fr;
    gap:16px;
  }
  
  .metric-grid{
    display:grid;
    grid-template-columns: repeat(3, 1fr);
    gap:12px;
    margin-top:12px;
  }

  .metric-grid--4{
    grid-template-columns: repeat(4, 1fr);
  }
  
  .metric-card{
    border:1px solid var(--line);
    border-radius:14px;
    background:#fbfcfe;
    padding:16px 14px;
  }
  
  .metric-label{
    font-size:14px;
    color:var(--muted);
    font-weight:800;
  }
  
  .metric-value{
    margin-top:8px;
    font-size:26px;
    line-height:1.15;
    font-weight:800;
    color:var(--text);
  }
  
  .metric-sub{
    margin-top:6px;
    font-size:12px;
    color:var(--muted);
  }
  
  .shortcut-grid{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:12px;
    margin-top:12px;
  }
  
  .shortcut-card{
    display:block;
    text-decoration:none;
    color:var(--text);
    border:1px solid var(--line);
    border-radius:14px;
    background:#fff;
    padding:14px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  }
  
  .shortcut-card:hover{
    transform: translateY(-1px);
    border-color: rgba(25, 180, 154, 0.40);
    box-shadow: 0 8px 20px rgba(16,24,40,0.08);
  }
  
  .shortcut-title{
    font-size:16px;
    font-weight:800;
    margin-bottom:6px;
  }
  
  .shortcut-desc{
    font-size:12px;
    color:var(--muted);
    line-height:1.5;
  }
  
  @media (max-width: 860px){
    .dashboard-grid{
      grid-template-columns: 1fr;
    }
  
    .metric-grid{
      grid-template-columns: 1fr;
    }

    .metric-grid--4{
      grid-template-columns: 1fr 1fr;
    }
  
    .shortcut-grid{
      grid-template-columns: 1fr;
    }
  }

/* TASK-027/028: テンプレ複製・並び順UI */
.input-sort{
  width:86px;
  min-width:86px;
  padding:7px 8px;
  border-radius:10px;
  text-align:right;
}

.row-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  justify-content:flex-end;
}

.row-actions form{
  margin:0;
}

.row-actions--templates{
  flex-wrap:nowrap;
  gap:4px;
}

.row-actions__group{
  display:inline-flex;
  flex-wrap:nowrap;
  gap:4px;
  align-items:center;
  flex-shrink:0;
}

.table--templates .col-actions{
  min-width:280px;
}

.table--templates .cell-actions{
  white-space:nowrap;
}

.table--templates .col-sort{
  min-width:110px;
}

/* TASK-027/028追加修正: ドラッグ式投稿順UI */
.template-order-note{
  margin: 0 0 12px 0;
}

.table--templates-order .col-order{
  width: 72px;
  min-width: 72px;
}

.table--templates-order .col-drag{
  width: 56px;
  min-width: 56px;
}

.template-delete-zone{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
}

.template-delete-zone__note{
  margin:0;
  font-size:13px;
}

.table--templates-order{
  min-width: 920px; /* PCでもはみ出しはスクロールで吸収 */
}

.cell-order{
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.cell-drag{
  text-align: center;
}

.drag-handle{
  width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  cursor: grab;
  font-weight: 700;
  line-height: 1;
}

.drag-handle:active{
  cursor: grabbing;
}

.template-row.dragging{
  opacity: .55;
  background: #eef9f6;
}

.table--templates-order tbody tr{
  transition: background .12s ease, opacity .12s ease;
}

.row-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  justify-content:flex-end;
}

.row-actions form{
  margin:0;
}

/* TASK: 直前割設定 */
.last-minute-discount-box{
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px;
  background:#fbfcfe;
}

.last-minute-discount-input{
  margin-top:10px;
  padding-left:24px;
}

.badge-discount{
  background:#fff7ed;
  color:#c2410c;
  border:1px solid #fed7aa;
}

.secret-mask{
  font-size:inherit;
  line-height:inherit;
  letter-spacing:0.05em;
}

/* スケジュール */
.schedule-tree{
  display:flex;
  flex-direction:column;
  gap:22px;
}
.schedule-salon{
  border-top:1px solid var(--line);
  padding-top:16px;
}
.schedule-salon:first-child{
  border-top:0;
  padding-top:0;
}
.schedule-salon__title{
  margin:0 0 12px 0;
  font-size:18px;
  font-weight:800;
}
.schedule-staff{
  border:1px solid var(--line);
  border-radius:12px;
  background:#fafbfc;
  padding:14px 16px;
  margin-bottom:12px;
}
.schedule-staff__head{
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  justify-content:space-between;
  gap:8px;
  margin-bottom:12px;
}
.schedule-staff__title{
  margin:0;
  font-size:15px;
  font-weight:800;
}
.schedule-staff__title a{
  color:inherit;
  text-decoration:none;
}
.schedule-staff__title a:hover{
  color:var(--accent);
}
.schedule-staff__grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
@media (max-width: 860px){
  .schedule-staff__grid{
    grid-template-columns:1fr;
  }
}
.schedule-panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:10px;
  padding:12px;
}
.schedule-panel__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:10px;
}
.schedule-panel__title{
  font-size:13px;
  font-weight:700;
  color:var(--muted);
}
.schedule-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.schedule-list__item{
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.schedule-list__item--plain{
  align-items:stretch;
}
.schedule-list__thumb{
  flex:0 0 auto;
}
.schedule-list__thumb .thumb-img,
.schedule-list__thumb .thumb-placeholder{
  width:48px;
  height:48px;
  border-radius:8px;
  border:1px solid var(--line);
  object-fit:cover;
  display:block;
  background:#f0f2f5;
}
.schedule-list__body{
  min-width:0;
  flex:1 1 auto;
}
.schedule-list__name{
  font-weight:700;
  font-size:13px;
  line-height:1.35;
}
.schedule-list__name a{
  color:inherit;
  text-decoration:none;
}
.schedule-list__name a:hover{
  color:var(--accent);
}
.schedule-list__order{
  color:var(--muted);
  margin-right:4px;
}
.schedule-discount-meta{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-top:6px;
}
.schedule-discount-meta__rate{
  font-size:12px;
  font-weight:800;
  color:var(--accent);
  white-space:nowrap;
}
.schedule-list__meta{
  margin-top:6px;
}
.schedule-list__reason{
  margin-top:4px;
  font-size:12px;
  line-height:1.4;
  white-space:pre-wrap;
}
