/* スズラン一括管理画面 — コーポレートカラー第3版 */
:root {
  --night: #0e1f17;
  --shadow: #13281f;
  --mint: #92d5a9;
  --cream: #eeebe2;
  --sage: #e2ece1;
  --deep: #24704a;
  --gray: #4b5a51;
  --lgray: #a9b6ad;
  --line: #c7dac7;
  --card: #eef3ec;
  --paper: #fafbf8;
  --warn: #b5651d;
  --warn-bg: #f6eadb;
  --danger: #a63d32;
  --danger-bg: #f5e1de;
  --ok-bg: #dcefe1;
  --radius: 10px;
  --font: 'Noto Sans JP', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--sage); color: var(--night); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--deep); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--gray); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* レイアウト */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--night); color: var(--cream); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
/* スズランのロゴ（形だけの画像を、色をつけて表示する。ホームページと同じ形） */
.brand-logo, .auth-logo { display: block; flex: none; -webkit-mask: url(/assets/logo-mark.png) center / contain no-repeat; mask: url(/assets/logo-mark.png) center / contain no-repeat; }
.brand-logo { width: 26px; height: 34px; background: var(--cream); }
.auth-logo { width: 36px; height: 48px; background: var(--night); margin-bottom: 14px; }
.brand b { display: block; font-size: 15px; letter-spacing: .04em; }
.brand span { font-size: 10px; letter-spacing: .18em; color: var(--mint); }
.nav-group { font-size: 10px; letter-spacing: .16em; color: var(--lgray); padding: 14px 12px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--cream); text-decoration: none; font-size: 13.5px; }
.nav a:hover { background: var(--shadow); }
.nav a.on { background: var(--mint); color: var(--night); font-weight: 600; }
.nav a .count { margin-left: auto; background: var(--mint); color: var(--night); border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.nav a.on .count { background: var(--night); color: var(--mint); }
.nav svg { width: 17px; height: 17px; flex: none; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--shadow); font-size: 12px; }
.side-foot b { display: block; font-size: 13px; }
.side-foot button { background: none; border: 1px solid var(--gray); color: var(--cream); border-radius: 6px; padding: 3px 10px; margin-top: 8px; cursor: pointer; font-size: 12px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px; }
.top h1 { font-size: 20px; margin: 0; letter-spacing: .03em; }
.top .sub { color: var(--gray); font-size: 12px; }
.top .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 12px 28px 48px; }
.top .menu-btn { display: none; }

/* 部品 */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h2 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card h2 .en { font-size: 10px; letter-spacing: .16em; color: var(--deep); font-weight: 600; }
.card h2 .right { margin-left: auto; font-weight: 400; font-size: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; display: block; }
.kpi .label { font-size: 11.5px; color: var(--gray); }
.kpi .value { font-size: 24px; font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 12px; font-weight: 500; margin-left: 2px; }
.kpi .foot { font-size: 11px; color: var(--gray); }
.kpi.alert { border-color: var(--mint); box-shadow: inset 4px 0 0 var(--mint); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 13px; white-space: nowrap; text-decoration: none; color: var(--night); }
.btn:hover { border-color: var(--deep); }
.btn.primary { background: var(--night); color: var(--cream); border-color: var(--night); }
.btn.primary:hover { background: var(--shadow); }
.btn.mint { background: var(--mint); border-color: var(--mint); color: var(--night); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.b-ok { background: var(--ok-bg); border-color: #b5dcc0; color: var(--deep); }
.b-warn { background: var(--warn-bg); border-color: #e7cba9; color: var(--warn); }
.b-danger { background: var(--danger-bg); border-color: #e6bdb7; color: var(--danger); }
.b-dark { background: var(--night); border-color: var(--night); color: var(--cream); }
.b-mint { background: var(--mint); border-color: var(--mint); color: var(--night); }
.tag.acc { background: var(--night); color: var(--mint); }
.tag { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 4px; background: var(--sage); color: var(--deep); margin: 1px 2px 1px 0; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; color: var(--gray); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 8px; border-bottom: 1px solid #dfe8de; vertical-align: top; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--card); }
.t td.r, .t th.r { text-align: right; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--gray); padding: 28px 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: none; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--night); color: var(--cream); }

label.f { display: block; font-size: 12px; color: var(--gray); margin-bottom: 10px; }
label.f > span { display: block; margin-bottom: 3px; }
input.i, select.i, textarea.i { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 10px; font-size: 14px; color: var(--night); }
input.i:focus, select.i:focus, textarea.i:focus { outline: 2px solid var(--mint); border-color: var(--deep); }
textarea.i { min-height: 90px; resize: vertical; }
.filters input.i, .filters select.i { width: auto; min-width: 140px; padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--deep); }

/* ドロワー・ダイアログ（広告・ポップアップ除けの拡張機能に消されないよう、よくある名前 modal / overlay は使わない） */
.hub-scrim { position: fixed; inset: 0; background: rgba(14, 31, 23, .38); z-index: 40; }
.hub-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--paper); z-index: 41; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(14, 31, 23, .18); }
.hub-dialog { position: fixed; left: 50%; top: 6vh; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); max-height: 88vh; background: var(--paper); z-index: 41; display: flex; flex-direction: column; border-radius: 14px; box-shadow: 0 20px 50px rgba(14, 31, 23, .25); }
.hub-dialog.wide { width: min(940px, calc(100% - 32px)); }
.d-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.d-head h3 { margin: 0; font-size: 16px; }
.d-head .x { margin-left: auto; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--gray); line-height: 1; }
.d-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.d-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; margin: 0 0 14px; }
.dl dt { color: var(--gray); }
.dl dd { margin: 0; word-break: break-all; }
.section-title { font-size: 11px; letter-spacing: .14em; color: var(--deep); font-weight: 700; margin: 18px 0 8px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--night); color: var(--cream); padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); }
.update-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 32px); background: var(--night); color: var(--cream); padding: 10px 16px; border-radius: 10px; z-index: 70; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--gray); }
.note.warn { background: var(--warn-bg); border-color: #e7cba9; color: #6d4419; }
.note b { color: var(--night); }

/* チャット */
.chat { display: grid; grid-template-columns: 290px 1fr 280px; height: calc(100vh - 100px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list .filters { padding: 10px; margin: 0; border-bottom: 1px solid var(--line); }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #e5ece4; }
.chat-item:hover { background: var(--card); }
.chat-item.on { background: var(--sage); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--deep); color: var(--cream); display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; font-size: 14px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-item .meta { min-width: 0; flex: 1; }
.chat-item .name { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13.5px; }
.chat-item .name time { margin-left: auto; font-weight: 400; color: var(--gray); font-size: 11px; }
.chat-item .last { color: var(--gray); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { background: var(--deep); color: #fff; border-radius: 99px; font-size: 10.5px; padding: 0 6px; }
.thread { display: flex; flex-direction: column; min-height: 0; background: #f2f6f0; }
.thread-head { padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); display: flex; align-items: center; gap: 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.msg.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--night); color: var(--cream); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.system { align-self: center; background: none; color: var(--gray); font-size: 11.5px; padding: 0; }
.msg-meta { font-size: 10.5px; color: var(--gray); }
.msg-meta.out { align-self: flex-end; }
.composer { border-top: 1px solid var(--line); background: var(--paper); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 160px; }
.chat-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 14px; }

/* カレンダー */
.cal { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.cal-grid { min-width: 980px; }
.cal-row { display: grid; grid-template-columns: 170px 1fr; border-bottom: 1px solid #dfe8de; }
.cal-row:last-child { border-bottom: 0; }
.cal-name { padding: 8px 12px; font-size: 12.5px; font-weight: 600; border-right: 1px solid var(--line); background: var(--paper); position: sticky; left: 0; z-index: 2; }
.cal-name small { display: block; font-weight: 400; color: var(--gray); font-size: 11px; }
.cal-track { position: relative; height: 52px; display: grid; }
.cal-day { border-right: 1px solid #e7eee6; cursor: pointer; }
.cal-day:hover { background: var(--card); }
.cal-day.we { background: #f3f6f1; }
.cal-day.today { background: #e3f3e8; }
.cal-head .cal-track { height: 40px; }
.cal-head .cal-day { cursor: default; font-size: 11px; text-align: center; padding-top: 3px; line-height: 1.3; color: var(--gray); }
.cal-head .cal-day b { display: block; font-size: 12.5px; color: var(--night); }
.cal-head .cal-day.sun b { color: var(--danger); }
.cal-head .cal-day.sat b { color: #2f5f8a; }
.bar { position: absolute; top: 8px; height: 36px; border-radius: 7px; padding: 2px 8px; font-size: 11.5px; line-height: 1.35; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; background: var(--deep); color: #fff; border: 1px solid rgba(0,0,0,.08); z-index: 1; }
.bar small { display: block; opacity: .85; font-size: 10.5px; }
.bar.pending { background: var(--mint); color: var(--night); }
.bar.in_use { background: var(--night); }
.bar.done { background: var(--lgray); color: var(--night); }
.bar.unpaid { box-shadow: inset 0 -3px 0 var(--warn); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--gray); margin: 10px 2px; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* メーター・グラフ */
.meter { height: 8px; background: var(--card); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: var(--deep); }
.meter.hot > i { background: var(--warn); }
.chart svg { width: 100%; height: auto; display: block; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid #e3ebe2; font-size: 13px; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .when { font-variant-numeric: tabular-nums; color: var(--gray); font-size: 12px; min-width: 88px; }

/* 問い合わせ */
.inbox { display: grid; grid-template-columns: 380px 1fr; gap: 14px; align-items: start; }
.inq-item { padding: 10px 12px; border-bottom: 1px solid #e3ebe2; cursor: pointer; }
.inq-item:hover { background: var(--card); }
.inq-item.on { background: var(--sage); }
.inq-item .s { font-weight: 600; font-size: 13.5px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .ev { margin-bottom: 12px; position: relative; font-size: 13px; white-space: pre-wrap; }
.timeline .ev::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; background: var(--mint); border-radius: 50%; border: 2px solid var(--paper); }

/* 権限表 */
.perm { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm th, .perm td { padding: 6px 8px; border-bottom: 1px solid #e3ebe2; }
.perm td.c { text-align: center; }
.perm input { accent-color: var(--deep); width: 16px; height: 16px; }
.role-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.role-card h4 { margin: 0 0 2px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip { font-size: 11px; border-radius: 4px; padding: 0 6px; background: var(--card); border: 1px solid var(--line); }
.chip.edit { background: var(--ok-bg); color: var(--deep); border-color: #b5dcc0; }
code.k { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; display: block; font-size: 12px; word-break: break-all; white-space: pre-wrap; }
.copy-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.copy-row code.k { flex: 1; }

/* ログイン */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--night); padding: 16px; }
.auth-card { width: min(400px, 100%); background: var(--paper); border-radius: 16px; padding: 28px; }
.auth-card h1 { font-size: 18px; margin: 10px 0 2px; }
.auth-card .en { font-size: 10px; letter-spacing: .2em; color: var(--deep); font-weight: 700; }

@media (max-width: 1100px) {
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat { grid-template-columns: 260px 1fr; }
  .chat-side { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .top .menu-btn { display: inline-flex; }
  .top { padding: 14px 16px 4px; flex-wrap: wrap; }
  .content { padding: 10px 16px 40px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 260px; }
  .thread { height: 70vh; }
  .inbox { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
}

/* LINEアカウント */
.acc-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; display: flex; gap: 12px; align-items: flex-start; }
.acc-card + .acc-card { margin-top: 10px; }
.acc-card .avatar { background: var(--night); color: var(--mint); }
.acc-card h4 { margin: 0; font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acc-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.acc-strip .kpi { flex: 1; min-width: 200px; display: flex; gap: 10px; align-items: center; }
