/* revsplit — UI デザインシステム（CLANE purple ベース・自己完結CSS） */
:root {
  --brand: #461787;
  --brand-600: #5a2aa0;
  --brand-50: #f3eefb;
  --ink: #1b1b2f;
  --muted: #6b6b80;
  --line: #e7e7ee;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ok: #1b9e6e;
  --warn: #c9821a;
  --danger: #c0362c;
  --info: #2b6cb0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 20, 50, .06), 0 8px 24px rgba(20, 20, 50, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }

/* ── ボタン ── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 10px; padding: 9px 16px; font-size: 14px;
  cursor: pointer; transition: .12s; font-weight: 500; }
.btn:hover { background: #fafafe; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ── フォーム ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #333; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 3px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── カード ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* ── バッジ ── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--brand-50); color: var(--brand); }
.badge.gray { background: #eef0f4; color: #5b5b6b; }
.badge.ok { background: #e6f6ef; color: var(--ok); }
.badge.warn { background: #fdf2e2; color: var(--warn); }

/* ── テーブル ── */
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }

/* ── ログイン画面 ── */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; max-width: 380px; width: 100%; padding: 36px; border-radius: 16px;
  box-shadow: var(--shadow); text-align: center; }
.brand-mark { font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }
.brand-mark .dot { color: var(--brand-600); }
.login-card p { color: var(--muted); margin: 8px 0 24px; }
.login-card .btn { width: 100%; justify-content: center; }
.err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ── アプリ・シェル ── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; }
.sidebar .team-switch { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.sidebar .team-name { font-weight: 700; font-size: 15px; margin-bottom: 16px; line-height: 1.3; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  color: #3a3a4a; font-size: 13.5px; font-weight: 500; margin-bottom: 1px; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav a .ic { width: 16px; text-align: center; opacity: .85; }
.nav .group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #a4a4b4;
  margin: 14px 11px 5px; }
.sidebar .foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar .foot .email { color: var(--ink); font-weight: 600; word-break: break-all; }

.main { padding: 26px 30px; max-width: 1100px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.page-head h1 { font-size: 21px; margin: 0; }
.page-head .desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar { display: none; }

/* ── KPI ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .value.muted { color: var(--muted); font-weight: 600; font-size: 16px; }

/* ── 空状態 / プレースホルダ ── */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 15px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.placeholder { border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); background: #fff; }
.placeholder .tag { display: inline-block; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }

/* ── パーティ表示 ── */
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.party-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; }
.party-card .role { font-size: 12px; color: var(--muted); }
.party-card .pname { font-size: 16px; font-weight: 700; margin: 2px 0 4px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); z-index: 50; opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--brand-50); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LP（ランディング） ── */
.lp { max-width: 980px; margin: 0 auto; padding: 0 20px 40px; }
.lp-nav { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; }
.lp-hero { text-align: center; padding: 48px 0 40px; }
.lp-tag { display: inline-block; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
.lp-hero h1 { font-size: 32px; line-height: 1.35; margin: 0 0 16px; letter-spacing: -.5px; }
.lp-hero p { color: var(--muted); font-size: 15px; margin: 0 0 26px; }
.lp-feat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 48px; }
.lp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.lp-ic { font-size: 26px; }
.lp-ct { font-weight: 700; margin: 8px 0 4px; }
.lp-cd { color: var(--muted); font-size: 13px; }
.lp-flow { text-align: center; background: var(--brand-50); border-radius: 18px; padding: 36px 20px; }
.lp-flow h2 { margin: 0 0 18px; }
.lp-flow ol { display: inline-block; text-align: left; color: #3a3a4a; line-height: 2; margin: 0 0 22px; }
.lp-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 36px 0 0; }
@media (max-width: 760px) { .lp-feat { grid-template-columns: 1fr 1fr; } .lp-hero h1 { font-size: 24px; } }

/* ── モーダル ── */
.modal-ov { position: fixed; inset: 0; background: rgba(20, 20, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; }
.modal-h .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { padding: 18px 20px; overflow: auto; }
.modal-f { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-f .err { margin: 0 auto 0 0; }

.item-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.item-row .field { margin: 0; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.money { font-variant-numeric: tabular-nums; }
.row-actions { text-align: right; white-space: nowrap; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .row2, .parties { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}
