/* StackTray 共通スタイル */
:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e3e5e9;
  --accent: #c8102e;        /* 防災レッド */
  --accent-weak: #fdecee;
  --ok: #15803d;
  --warn: #b45309;
  --warn-weak: #fef3c7;
  --danger: #b91c1c;
  --danger-weak: #fee2e2;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 14px; margin: 24px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ヘッダー */
.st-header {
  display: flex; align-items: center; gap: 24px;
  height: 48px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.st-brand { font-weight: 700; color: var(--accent); text-decoration: none; letter-spacing: .02em; }
.st-header nav { display: flex; gap: 4px; overflow-x: auto; }
.st-header nav a {
  padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.st-header nav a:hover { background: var(--bg); color: var(--text); }
.st-header nav a[aria-current="page"] { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.st-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.st-user a { color: var(--muted); }
.meta-actions { display: flex; gap: 12px; }

/* ログイン画面 */
.auth-box {
  max-width: 360px; margin: 15vh auto; padding: 32px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.auth-box .st-brand { font-size: 22px; margin-bottom: 8px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }

/* レイアウト */
.layout { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 48px); }
.list-pane { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-tools { display: flex; gap: 8px; padding: 12px; }
.list-tools input { flex: 1; min-width: 0; }
.list-meta { display: flex; justify-content: space-between; padding: 0 12px 8px; color: var(--muted); font-size: 12px; }
.detail-pane { overflow-y: auto; padding: 24px 32px 64px; }
.back { display: none; }

/* 一覧 */
.prop-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; border-top: 1px solid var(--line); }
.prop-list a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.prop-list a:hover { background: var(--bg); }
.prop-list a.active { background: var(--accent-weak); box-shadow: inset 3px 0 0 var(--accent); }
.prop-list .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prop-list .row2 { display: flex; gap: 6px; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.prop-list .empty { padding: 24px; text-align: center; color: var(--muted); }
.tag { flex: none; padding: 0 6px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; }

/* 詳細 */
.placeholder { color: var(--muted); padding: 48px 0; text-align: center; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; }
table.kv { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.kv th, table.kv td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }
table.kv th { width: 140px; font-weight: 500; color: var(--muted); background: #fafbfc; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.chips li { padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.notes { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0; }

/* フォーム */
input, select, textarea {
  font: inherit; color: inherit; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
.prop-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 16px; padding: 12px 16px 16px; }
.prop-form legend { font-weight: 600; padding: 0 6px; }
.prop-form .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.prop-form label > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.prop-form label em { color: var(--accent); font-style: normal; }
.prop-form .wide { grid-column: 1 / -1; }
.equip-group { margin-top: 8px; }
.equip-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.equip-items { display: flex; flex-wrap: wrap; gap: 4px 16px; }
label.check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
label.check input { width: auto; }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1f2328; color: #fff; padding: 10px 18px; border-radius: 6px; z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.toast.error { background: var(--danger); }

/* スマホ */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .list-pane { border-right: 0; }
  .detail-pane { display: none; padding: 16px; }
  body.show-detail .list-pane { display: none; }
  body.show-detail .detail-pane { display: block; }
  .back { display: inline-block; margin-bottom: 12px; color: var(--accent); text-decoration: none; }
  .detail-head { flex-direction: column; }
  table.kv th { width: 100px; }
}

/* お試し版表示 */
.trial { padding: 1px 8px; border-radius: 4px; background: var(--warn-weak); color: var(--warn); font-weight: 600; }

/* 規約などの文書ページ */
.doc { max-width: 760px; margin: 0 auto; padding: 32px 24px 80px; background: var(--surface); min-height: calc(100vh - 48px); }
.doc h1 { font-size: 22px; margin-bottom: 16px; }
.doc h2 { font-size: 15px; color: var(--text); margin-top: 28px; }
.doc ol { padding-left: 1.6em; }
.doc li { margin: 4px 0; }
.doc .notice { background: var(--warn-weak); border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: 4px; }
