/* 管理コンソール固有のスタイル（共通部分は shared/admin.css） */

/* 配色: SK Hub Systems（SK の六角形アイコンの青）。shared/admin.css の Y-FILTER. の金色を上書きする */
:root {
  --bg: #f3f6fb;
  --surface-2: #f6f8fc;
  --border: #e1e7f0;
  --border-strong: #cad4e3;
  --primary: #1a56db;
  --primary-hover: #1646b3;
  --primary-soft: #e8f0ff;
  --primary-ring: rgba(26, 86, 219, 0.22);
}
.notice { border-color: #cddcff; }
/* 名前（Y-FILTER.）の下に、提供元の SK Hub Systems を小さく添える */
.brand-sk { display: flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0.02em; }
.brand-sk img { width: 12px; height: 12px; flex: none; }

[hidden] { display: none !important; }
.btn svg { width: 16px; height: 16px; }
#signin-btn svg { stroke: none; }
.danger-text { color: var(--danger); }
.user { font-size: 12.5px; color: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.summary { margin-bottom: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.select-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.btn-select { width: auto; padding: 8px 12px; border-radius: 10px; font-weight: 600; }

table.devices th.cb, table.devices td.cb { width: 36px; }
table.devices td { vertical-align: middle; }
table.devices tr.selected td { background: var(--primary-soft); }
.dev-name { font-weight: 600; }
.dev-sub { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--ok); background: var(--ok-soft); }
.pill.off { color: var(--faint); background: var(--surface-2); }
.pill.warn { color: #a15c00; background: #fff4d6; }
.pill.info { color: var(--primary); background: var(--primary-soft); }
.pill.danger { color: var(--danger); background: var(--danger-soft); margin-top: 4px; }
.warn-notice { margin-bottom: 16px; border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--primary-soft); }
.empty { padding: 40px 20px; text-align: center; }
.empty p { margin: 0 0 6px; }

/* ダイアログ */
.dlg { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,0.25); overflow: hidden; }
.dlg[open] { display: flex; flex-direction: column; }
.dlg-wide { width: min(820px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(20, 24, 33, 0.45); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { font-size: 17px; margin: 0; }
.dlg-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.dlg-x:hover { background: var(--surface-2); }
.dlg-body { padding: 18px 22px; overflow: auto; }
.dlg-body > * + * { margin-top: 10px; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.dlg-foot .hint { margin-right: auto; }

.pair-code { margin: 18px 0 6px; text-align: center; font: 800 40px/1.2 var(--mono); letter-spacing: 0.16em; color: var(--primary); }
.pair-exp { text-align: center; }
.pair-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--font) !important; }
.pair-row b { font-family: var(--mono); letter-spacing: 0.08em; }
/* 自分の端末のバックアップの一覧（名前は等幅にしない） */
#backup-rows .pair-row b { font-family: var(--font); letter-spacing: 0; }
#backup-rows .pair-row .hint { flex: 1; }
/* 端末一覧の「自分の端末」「管理している端末」の見出しの行 */
table.data tr.group-row td { background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; padding-top: 7px; padding-bottom: 7px; }

.radio { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 6px 0; cursor: pointer; }
.radio input { accent-color: var(--primary); }

/* 設定エディタ */
.ed-section { margin-top: 18px; }
.ed-section:first-child { margin-top: 0; }
.ed-section h3 { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; margin: 0 0 8px; }
.ed-field { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.ed-field.stack { display: block; }
.ed-field.stack > .ed-label { margin-bottom: 8px; }
.ed-field.dirty { border-color: var(--primary); background: var(--primary-soft); }
.ed-label { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ed-desc { font-size: 12px; color: var(--muted); font-weight: 400; }
.ed-badge { display: none; font-size: 10.5px; font-weight: 700; color: var(--primary); background: #fff; border: 1px solid var(--primary); border-radius: 999px; padding: 0 8px; }
.ed-field.dirty .ed-badge { display: inline-block; }
.ed-field select, .ed-field input[type="text"], .ed-field input[type="time"] { width: auto; min-width: 200px; }
.ed-field textarea { min-height: 90px; }

/* ヘッダー（サイト共通の見た目・高さ 52px で固定）。中身は管理コンソール用（console-header.js） */
body { padding-top: 52px; }
.gate { min-height: calc(100vh - 52px); }
.site-header > a.hd-console-name { font-weight: 700; padding-right: 20px; margin-right: 8px; position: relative; }
.site-header > a.hd-console-name::after { content: ""; position: absolute; right: 0; top: 50%; width: 1px; height: 16px; margin-top: -8px; background: rgba(0, 0, 0, .14); }
.console-header .hd-logo-image img { width: 24px; height: 24px; }

/* ページの見出し（どの管理コンソールかを小さく添える） */
.console-kicker { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--primary); letter-spacing: 0.02em; }
.console-kicker img { width: 14px; height: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions .btn, .page-actions .btn-select { border-radius: 999px; }
.page { max-width: 1180px; }

.signin-terms { margin-top: 14px; font-size: 12px; }
.signin-terms a { color: var(--primary); }
.stat-value[data-state="warn"] { color: #a15c00; }

/* リクエスト */
.requests-card { margin-bottom: 16px; border-color: #f0c36a; }
.request-list { display: flex; flex-direction: column; }
.request-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--border); }
.request-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.request-domain { font-weight: 700; font-size: 15px; }
.request-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; text-decoration: none; }
.request-url:hover { text-decoration: underline; }
.request-message { margin-top: 4px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.request-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
td.usage { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.report th, table.report td { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
table.report th:first-child, table.report td:first-child { text-align: left; }
.schedule-edit { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.schedule-edit .schedule-rules { width: 100%; }
.ed-field .schedule-rule input[type="time"] { min-width: 0; }
#detail-usage { margin-top: 6px; }

/* 管理者 */
.member-list { display: flex; flex-direction: column; gap: 6px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.member-main { min-width: 0; }
.member-row .pill { margin-left: 6px; }
.member-row .pill::before { display: none; }
.invite-code { font: 800 22px/1.2 var(--mono); letter-spacing: 0.12em; color: var(--primary); }
input.num { width: 90px; min-width: 0 !important; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50; padding: 12px 18px; border-radius: 12px; background: #141821; color: #fff; font-size: 13px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); transition: opacity 180ms ease, transform 180ms ease; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

@media (max-width: 860px) {
  .toolbar-actions { margin-left: 0; }
  .request-row { flex-direction: column; }
  .request-actions { justify-content: flex-start; }
  .ed-field { flex-direction: column; }
  .ed-field select, .ed-field input[type="text"] { width: 100%; }
}

/* SK Hub Systems のアクセスチェック（右下の表示・同意カード）と重ならないよう、通知を上げる */
@media (max-width: 760px) {
  body:has([data-RedCheckOSS-info-widget]) .toast { bottom: 72px; }
  body:has([data-RedCheckOSS-consent-card]) .toast { bottom: 200px; }
}
