@charset "UTF-8";
/* ============================================================
   ULTHERIA 管理画面共通スタイル
   アクセント: #2c3e50 / クリーンなフラット系
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #2c3e50;
  --accent-light: #3d566e;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --border: #dde3e8;
  --text: #2f3a44;
  --muted: #7b8a97;
  --danger: #c0392b;
  --ok: #27ae60;
}

[x-cloak] { display: none !important; }

html { font-size: 14px; }

body {
  font-family: "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ---------- トップバー ---------- */

.admin-topbar {
  background: var(--accent);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  gap: 8px;
}

.topbar-logo {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 17px;
  letter-spacing: 2px;
  margin-right: 16px;
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.topbar-nav a {
  color: rgba(255,255,255,.78);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 13px;
  transition: background .15s, color .15s;
}

.topbar-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar-nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: bold; }

.topbar-user {
  color: rgba(255,255,255,.9);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ---------- メイン ---------- */

.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.page-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.admin-footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 2px;
  padding: 20px 0 30px;
}

/* ---------- カード ---------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  color: var(--accent);
  border-left: 4px solid var(--accent);
  padding-left: 10px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 13px;
  color: var(--accent);
  margin: 16px 0 8px;
}

/* ---------- タブ ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tabs button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--muted);
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}

.tabs button:hover { color: var(--accent); }
.tabs button.active {
  color: var(--accent);
  font-weight: bold;
  border-bottom-color: var(--accent);
}

/* ---------- テーブル ---------- */

.tbl-wrap { overflow-x: auto; }

/* data-table（ユーザ設定・環境設定のボット一覧等）。.tbl と同スタイル */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg);
  color: var(--accent);
  font-weight: bold;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  vertical-align: middle;
  background: #fff;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th {
  background: var(--bg);
  color: var(--accent);
  font-weight: bold;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tbl td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  vertical-align: middle;
  background: #fff;
}

.tbl tr:hover td { background: #f9fbfc; }

.tbl .num { text-align: right; }
.tbl .ctr { text-align: center; }

.tbl input, .tbl select {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  min-width: 60px;
}

/* ---------- フォーム ---------- */

.frm-row { margin-bottom: 12px; }

.frm-row label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 4px;
}

.frm-row .req {
  color: var(--danger);
  font-size: 11px;
  margin-left: 4px;
}

.frm-row input[type="text"],
.frm-row input[type="number"],
.frm-row input[type="date"],
.frm-row input[type="month"],
.frm-row input[type="password"],
.frm-row select,
.frm-row textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
}

.frm-row input:focus,
.frm-row select:focus,
.frm-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(44,62,80,.12);
}

.frm-row textarea { resize: vertical; min-height: 70px; }

.frm-row input[type="color"] {
  width: 60px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}

.frm-hint { font-size: 11px; color: var(--muted); margin-top: 3px; }

.frm-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.frm-inline .frm-row { margin-bottom: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.radio-list { display: flex; flex-direction: column; gap: 8px; }

.radio-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color .15s, background .15s;
}

.radio-list label:hover { background: #f9fbfc; }
.radio-list label.checked { border-color: var(--accent); background: #eef2f6; }
.radio-list input[type="radio"] { margin-top: 4px; }

.radio-inline { display: flex; flex-wrap: wrap; gap: 14px; }
.radio-inline label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 13px; }

/* ---------- ボタン ---------- */

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  line-height: 1.4;
}

.btn:hover { background: #f0f3f5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-light); }

.btn-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover { background: #fdf0ee; }

.btn-sm { padding: 3px 9px; font-size: 12px; }

.btn-move {
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.2;
}

/* ---------- バッジ・ステータス ---------- */

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.badge-invoice { background: var(--accent); color: #fff; }
.badge-quote { background: var(--ok); color: #fff; }
.badge-on { background: var(--ok); color: #fff; }
.badge-off { background: #aab4bd; color: #fff; }

.color-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.15);
  vertical-align: middle;
}

/* ---------- メッセージ・注記 ---------- */

.msg-ok {
  color: var(--ok);
  font-size: 13px;
  font-weight: bold;
}

.msg-err { color: var(--danger); font-size: 13px; }

.note {
  background: #f4f8fb;
  border: 1px solid #d4e2ec;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  color: #44606f;
  margin: 12px 0;
}

/* プラン選択（ユーザ設定 > お支払い・プラン）。金額はStripeの価格をそのまま出す */
.plan-pick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 240px));
  gap: 12px;
}
.plan-pick__item {
  border: 1px solid #d9e2e8;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.plan-pick__name { font-weight: 700; font-size: 14px; color: #2c3e50; }
.plan-pick__desc { font-size: 12px; color: #7f8c8d; line-height: 1.7; margin-top: 4px; }
.plan-pick__btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 削除予定日など、放置すると不利益が出る告知。通常の .note より強い色にする */
.note.note-warn {
  background: #fff6f5;
  border-color: #f0c4bd;
  color: #8a3b30;
}

.note ul, .note ol { margin-left: 20px; }
.note li { margin: 2px 0; }

.result-box {
  background: #f0f9f3;
  border: 1px solid #bfe6cc;
  border-radius: 6px;
  padding: 16px;
  margin-top: 14px;
}

.muted { color: var(--muted); font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }

/* ---------- コピー欄 ---------- */

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-row input {
  flex: 1;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f9fbfc;
  color: var(--text);
}

/* ---------- モーダル ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,40,50,.45);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}

.modal h2 {
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ---------- 合計表示 ---------- */

.totals {
  margin-top: 12px;
  margin-left: auto;
  width: 280px;
  max-width: 100%;
  font-size: 13px;
}

.totals .trow {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.totals .trow.grand {
  font-weight: bold;
  font-size: 15px;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* ---------- 変更履歴 diff ---------- */

.diff-line {
  font-size: 12px;
  padding: 1px 0;
  word-break: break-all;
}

.diff-line .df { font-weight: bold; color: var(--accent); }
.diff-line .db { color: var(--danger); text-decoration: line-through; }
.diff-line .da { color: var(--ok); }

/* ---------- ページャ ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

/* ---------- ロゴプレビュー ---------- */

.logo-preview {
  max-width: 220px;
  max-height: 90px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  background: #fff;
  display: block;
  margin-bottom: 8px;
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 768px) {
  .topbar-menu-btn { display: block; order: 3; }
  .topbar-user { margin-left: auto; max-width: 110px; }

  .topbar-nav {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--accent);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px 14px;
    box-shadow: 0 6px 12px rgba(0,0,0,.2);
  }

  .topbar-nav.open { display: flex; }
  .topbar-nav a { padding: 11px 12px; font-size: 14px; }

  .grid-2 { grid-template-columns: 1fr; }
  .admin-main { padding: 16px 10px 50px; }
  .card { padding: 14px; }
  .totals { width: 100%; }
  .modal { padding: 16px; }
}

/* 月次請求プレビューの請求名称見出し行 */
.mb-header-row td { background: #f3f6fa; }

/* フッタの法務リンク（Stripe審査要件: 決済サイトから料金・規約・特商法へ到達できること） */
.admin-footer-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  letter-spacing: 0;
}
.admin-footer-links a {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}
.admin-footer-links a:hover { text-decoration: underline; }
