* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #0a2540; --blue: #2c5f8d; --accent: #69a5d4; --gold: #f6c842;
  --line: #d1d9e0; --line-soft: #e5e7eb; --bg: #f4f6f9; --ok: #16a34a; --danger: #d63031;
  --text: #1a2332; --muted: #6b7280;
}
body { font-family: "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

.btn { padding: 9px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 700; font-family: inherit; transition: background .15s, opacity .15s; }
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: #1a2332; }
.btn-primary:hover { background: #e9b929; opacity: 1; }
.btn-ghost { background: #e5e7eb; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="url"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(105,165,212,.2); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 5px; }
label.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-card { background: #fff; border-radius: 14px; box-shadow: 0 8px 30px rgba(10,37,64,.12); padding: 32px 28px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 800; font-size: 20px; }
.login-title { font-size: 20px; color: var(--navy); margin: 10px 0 2px; }
.login-sub { font-size: 12px; color: var(--muted); }
.login-error { background: #fdecea; color: #b91c1c; border: 1px solid #f5c2c0; border-radius: 7px; padding: 9px 11px; font-size: 13px; margin-bottom: 12px; }

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: 0 0 232px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; cursor: pointer; border-radius: 8px; text-decoration: none; color: inherit; }
.side-brand:hover { background: #f0f4f8; }
.side-brand .brand-mark { width: 34px; height: 34px; font-size: 14px; border-radius: 9px; }
.side-brand .brand-name { font-weight: 800; font-size: 16px; color: var(--navy); }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.side-item { text-align: left; background: transparent; border: none; border-radius: 8px; padding: 10px 12px; font-size: 14px; font-weight: 700; color: #4a5568; cursor: pointer; font-family: inherit; }
.side-item:hover { background: #f0f4f8; }
.side-item.active { background: #e8f2fa; color: var(--blue); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.side-link { text-align: left; background: transparent; border: none; padding: 8px 12px; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit; border-radius: 6px; }
.side-link:hover { background: #f0f4f8; color: var(--blue); }
.side-user { font-size: 11px; color: var(--muted); padding: 8px 12px 2px; }
.content { flex: 1; min-width: 0; padding: 24px; max-width: 1240px; }

.panel { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.05); padding: 22px; margin-bottom: 18px; }
.panel h2 { font-size: 18px; color: var(--navy); margin-bottom: 6px; }
.panel .hint { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.subhead { font-size: 14px; color: var(--navy); font-weight: 700; margin: 16px 0 8px; border-bottom: 1px solid #c4dded; padding-bottom: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.empty { text-align: center; color: #9ca3af; padding: 36px; }

/* portal service cards */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.svc-card { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; transition: box-shadow .15s, transform .1s, border-color .15s; }
.svc-card:hover { box-shadow: 0 6px 20px rgba(10,37,64,.12); border-color: var(--accent); transform: translateY(-2px); }
.svc-card .svc-icon { font-size: 34px; }
.svc-card .svc-name { font-size: 16px; font-weight: 800; color: var(--navy); margin: 8px 0 4px; }
.svc-card .svc-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* お知らせ掲示板 */
.ann-head-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.ann-head-row h2 { margin-bottom:0; }
.ann-toggle { flex:0 0 auto; }
.ann-form { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; padding:12px; border:1px solid var(--line-soft); border-radius:10px; background:#fbfcfe; }
.ann-item { border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:8px; padding:12px 14px; margin-bottom:10px; background:#fcfdff; }
.ann-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.ann-title { font-weight:800; color:var(--navy); font-size:15px; }
.ann-body { font-size:13px; margin-top:6px; color:var(--text); line-height:1.7; word-break:break-word; }
.ann-body img { max-width:100%; height:auto; border-radius:6px; }
.ann-body a { color:var(--blue); }
.ann-meta { font-size:11px; color:var(--muted); margin-top:8px; }

/* ログ管理：末尾の案内 */
.al-foot { text-align:center; color:var(--muted); font-size:12px; padding:14px 0 2px; }

/* 日程調整 */
.sc-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:6px; }
.sc-head h2 { margin-bottom:0; }
.sc-item { border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:8px; padding:12px 14px; margin-bottom:10px; background:#fcfdff; }
.sc-item-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.sc-item-title { font-weight:800; color:var(--navy); font-size:15px; }
.sc-badges { display:flex; gap:6px; flex-wrap:wrap; flex:0 0 auto; }
.badge.sc-open { background:#e8f5ec; color:#16a34a; }
.badge.sc-closed { background:#f1f3f5; color:#6b7280; }
.badge.sc-money { background:#fef3c7; color:#92400e; }
.sc-item-meta { font-size:12px; color:var(--muted); margin-top:6px; }
.sc-item-actions { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
/* 候補日カレンダー */
.sc-cal { max-width:360px; border:1px solid var(--line); border-radius:10px; padding:10px; background:#fff; }
.sc-cal-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.sc-cal-title { font-weight:800; color:var(--navy); }
.sc-cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.sc-cal-wd { text-align:center; font-size:11px; color:var(--muted); font-weight:700; padding:2px 0; }
.sc-cal-wd.sun { color:#d63031; } .sc-cal-wd.sat { color:#2c5f8d; }
.sc-cal-cell { aspect-ratio:1/1; }
.sc-cal-cell.blank { visibility:hidden; }
.sc-cal-cell.day { border:1px solid var(--line); background:#fff; border-radius:8px; cursor:pointer; font-size:13px; font-family:inherit; display:flex; align-items:center; justify-content:center; padding:0; }
.sc-cal-cell.day.sun { color:#d63031; } .sc-cal-cell.day.sat { color:#2c5f8d; }
.sc-cal-cell.day:hover { background:#eef4fa; }
.sc-cal-cell.day.today { border-color:var(--accent); font-weight:800; }
.sc-cal-cell.day.selected { background:var(--blue); color:#fff; border-color:var(--blue); }
.sc-selected { margin-top:12px; }
.sc-sel-row { display:flex; gap:8px; align-items:center; margin-bottom:6px; }
.sc-sel-date { flex:1; font-size:13px; color:var(--navy); font-weight:700; }
.sc-time-field { max-width:200px; }
.sc-members { display:flex; flex-wrap:wrap; gap:8px 14px; padding:10px 12px; border:1px solid var(--line-soft); border-radius:8px; max-height:200px; overflow:auto; background:#fff; }
.sc-mem { font-size:13px; display:inline-flex; align-items:center; gap:5px; }
.sc-mem-tools { display:flex; gap:8px; margin-bottom:8px; }

/* 使い方チャット（フローティング） */
.fab-help { position:fixed; right:22px; bottom:22px; z-index:60; background:var(--accent); color:#fff; border:none; border-radius:26px; padding:12px 20px; font-size:14px; font-weight:800; font-family:inherit; cursor:pointer; box-shadow:0 6px 20px rgba(10,37,64,.25); }
.fab-help:hover { background:#4a89bf; }
.chat-modal { position:fixed; right:22px; bottom:78px; z-index:61; width:360px; max-width:calc(100vw - 32px); background:#fff; border-radius:14px; box-shadow:0 12px 40px rgba(10,37,64,.3); overflow:hidden; border:1px solid var(--line); }
.chat-modal[hidden] { display:none; }
.chat-modal-head { background:var(--navy); color:#fff; padding:12px 14px; font-weight:700; display:flex; justify-content:space-between; align-items:center; }
.chat-close { background:transparent; border:none; color:#fff; font-size:22px; cursor:pointer; line-height:1; padding:0 4px; }
.chat-modal-body { display:flex; flex-direction:column; }
.chat-log { padding:12px; max-height:320px; overflow:auto; display:flex; flex-direction:column; gap:8px; }
.chat-msg { max-width:85%; padding:9px 12px; border-radius:12px; font-size:13px; line-height:1.55; white-space:pre-wrap; }
.chat-msg.bot { background:#eef2f7; color:var(--text); align-self:flex-start; border-bottom-left-radius:4px; }
.chat-msg.user { background:var(--blue); color:#fff; align-self:flex-end; border-bottom-right-radius:4px; }
.chat-chips { display:flex; flex-wrap:wrap; gap:6px; padding:0 12px 8px; }
.chip { border:1px solid var(--accent); background:#fff; color:var(--blue); border-radius:16px; padding:5px 12px; font-size:12px; cursor:pointer; font-family:inherit; }
.chip:hover { background:#e8f2fa; }
.chat-input-row { display:flex; gap:8px; padding:10px 12px; border-top:1px solid var(--line-soft); }
.chat-input-row input { flex:1; }
.svc-edit-row td { background:#f7fafd; padding:14px; }

/* キャラクター画像（Poro） */
.poro-hero { display:flex; align-items:center; gap:14px; background:#fff; border-radius:12px; box-shadow:0 2px 12px rgba(0,0,0,.05); padding:14px 18px; margin-bottom:18px; }
.poro-hero-img { width:96px; height:96px; flex:0 0 auto; }
.poro-hero-title { font-size:18px; font-weight:800; color:var(--navy); }
.poro-hero-sub { font-size:12px; color:var(--muted); margin-top:2px; }
.svc-card .svc-icon img { width:56px; height:56px; display:block; }
.empty.poro-empty { display:flex; align-items:center; justify-content:center; gap:12px; padding:16px 14px; text-align:left; }
.poro-empty img { width:52px; height:52px; opacity:.95; flex:0 0 auto; }
.login-poro { display:block; margin:0 auto 6px; width:88px; height:88px; }
.login-logo { display:block; width:200px; max-width:78%; height:auto; margin:0 auto 10px; }
@media (max-width:560px){ .poro-hero-img { width:72px; height:72px; } }
/* 背景つきイラスト（完了・クリップボード）は角丸タイルで見せる */
.poro-tile { border-radius:14px; }
.sc-hero { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.sc-hero .hint { margin:0; }
.sc-hero img { width:64px; height:64px; flex:0 0 auto; }
.sc-done-img { display:block; width:96px; height:96px; margin:8px auto 0; }
.brand-img { width:40px; height:40px; flex:0 0 auto; display:block; }
.sc-check { display:inline-flex; align-items:center; gap:8px; font-size:14px; font-weight:700; color:var(--navy); margin-bottom:8px; }
.sc-notice { border-radius:8px; padding:10px 12px; margin:10px 0; font-size:13px; line-height:1.7; }
.sc-notice-closed { background:#f1f3f5; color:#4a5568; }
.sc-notice-money { background:#fffbeb; border:1px solid #fde68a; color:#7c5e10; }
.sc-money-note { font-size:12px; color:#8a6d1a; margin-top:6px; }
.sc-desc { font-size:13px; color:var(--text); white-space:pre-wrap; margin:8px 0 12px; }
.sc-date-list { display:flex; flex-direction:column; gap:8px; margin:10px 0; }
.sc-ans-row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; border:1px solid var(--line-soft); border-radius:8px; padding:8px 12px; background:#fff; }
.sc-ans-label { font-weight:700; color:var(--navy); flex:1 1 180px; }
.sc-ans-opts { display:flex; gap:10px; flex-wrap:wrap; }
.sc-ans-opt { display:inline-flex; align-items:center; gap:4px; font-size:14px; cursor:pointer; }
.sc-ans-count { font-size:12px; color:var(--muted); flex:0 0 auto; }
.sc-matrix-wrap { overflow-x:auto; }
.sc-matrix th, .sc-matrix td { white-space:nowrap; }
/* 参加できる日ランキング（自動更新） */
.sc-rank { margin-top:6px; }
.sc-rank-row { display:flex; align-items:center; gap:10px; padding:6px 8px; border-radius:8px; }
.sc-rank-row.top { background:#eef6ff; }
.sc-rank-no { flex:0 0 22px; height:22px; border-radius:50%; background:#cbd5e0; color:#fff; font-weight:800; font-size:12px; display:flex; align-items:center; justify-content:center; }
.sc-rank-row.top .sc-rank-no { background:var(--blue); }
.sc-rank-mid { flex:1; min-width:0; }
.sc-rank-label { font-size:13px; color:var(--navy); font-weight:700; }
.sc-rank-bar { height:8px; background:#eef2f7; border-radius:6px; overflow:hidden; margin-top:3px; }
.sc-rank-fill { height:8px; background:var(--accent); border-radius:6px; }
.sc-rank-cnt { flex:0 0 auto; font-size:12px; color:var(--blue); font-weight:700; }
.sc-bw0{width:0} .sc-bw10{width:10%} .sc-bw20{width:20%} .sc-bw30{width:30%} .sc-bw40{width:40%} .sc-bw50{width:50%} .sc-bw60{width:60%} .sc-bw70{width:70%} .sc-bw80{width:80%} .sc-bw90{width:90%} .sc-bw100{width:100%}

/* リッチエディタ ツールバー */
.rt-toolbar { display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:6px; border:1px solid var(--line); border-bottom:none; border-radius:8px 8px 0 0; background:#f7f9fc; }
.rt-btn { border:1px solid var(--line); background:#fff; border-radius:6px; padding:4px 10px; font-size:13px; cursor:pointer; font-family:inherit; }
.rt-btn:hover { background:#e8f2fa; }
.rt-sel { padding:4px 6px; font-size:13px; border:1px solid var(--line); border-radius:6px; font-family:inherit; }
.rt-colors { display:inline-flex; gap:5px; align-items:center; }
.rt-color { width:20px; height:20px; border-radius:50%; border:1px solid #cbd5e0; cursor:pointer; display:inline-block; }
.rt-editor { border:1px solid var(--line); border-radius:0 0 8px 8px; min-height:90px; max-height:360px; overflow:auto; padding:10px 12px; font-size:14px; background:#fff; line-height:1.7; }
.rt-editor:empty:before { content: attr(data-placeholder); color:#9ca3af; }
.rt-editor:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px rgba(105,165,212,.2); }
.rt-editor img { max-width:100%; height:auto; }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { background: var(--navy); color: #fff; text-align: left; padding: 9px 10px; font-size: 12px; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr:hover td { background: #f7fafd; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #eef2f7; color: #4a5568; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-tag { font-size: 11px; background: #e8f2fa; color: var(--blue); border-radius: 10px; padding: 2px 8px; }
.perm-box { display: flex; flex-wrap: wrap; gap: 10px; }
.perm-box label { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,37,64,.45); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal-card h3 { font-size: 17px; color: var(--navy); margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 80; }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }

.save-bar { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.list-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.list-toolbar .search { flex: 1; min-width: 200px; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; border-right: none; border-bottom: 1px solid var(--line); }
  .side-nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .side-bottom { margin-top: 0; border-top: none; padding-top: 0; flex-direction: row; flex-wrap: wrap; }
  .side-user { width: 100%; }
}

/* アイコン／ブランド画像管理 */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
.brand-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.brand-prev { display: flex; align-items: center; justify-content: center; height: 88px; border-radius: 8px;
  background: #f4f6f9 repeating-conic-gradient(#e9edf2 0% 25%, transparent 0% 50%) 50% / 16px 16px; }
.brand-prev img { width: 64px; height: 64px; object-fit: contain; }
.brand-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-label { font-size: 13px; font-weight: 700; color: var(--text); }
.brand-state { font-size: 11px; color: var(--muted); white-space: nowrap; }
.brand-state.is-custom { color: var(--ok); font-weight: 700; }
.brand-actions { display: flex; gap: 8px; }
.brand-actions .btn { flex: 1; }
.brand-file { display: none; }

/* アイコン画像：未設定スロットのプレースホルダ */
.brand-ph { font-size: 34px; color: var(--muted); display: flex; align-items: center; justify-content: center; line-height: 1; }

/* サービス管理：一覧アイコンの画像表示 */
.svc-ic-img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; vertical-align: middle; }

/* 左メニュー：サービスグループ（折りたたみ） */
.side-group { display: flex; flex-direction: column; }
.side-group-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; background: none; border: none; cursor: pointer; font-family: inherit; text-align: left; padding: 11px 12px; border-radius: 8px; font-size: 15px; font-weight: 700; color: var(--text); }
.side-group-head:hover { background: #f1f5fa; }
.side-caret { font-size: 15px; color: var(--blue); margin-left: auto; }
.side-group-body { display: flex; flex-direction: column; gap: 2px; padding-left: 10px; margin-bottom: 4px; }
.side-group-body[hidden] { display: none; }
.side-sub { display: flex; align-items: center; gap: 8px; text-decoration: none; background: none; border: none; cursor: pointer; font-family: inherit; text-align: left; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #374151; }
.side-sub:hover { background: #f1f5fa; }
.side-sub-ic { width: 20px; flex: 0 0 20px; text-align: center; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.side-sub-ic img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }
.side-sub-nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
