/* 管理画面共通デザイン (LINEチャット画面と同じトーン) */
:root {
    /* メインカラー #5b9db7 と、同系の深い青緑(左メニュー)・淡い水色(面) */
    --rd-nav-bg: #1c3747;
    --rd-nav-fg: #b8cbd6;
    --rd-nav-fg-strong: #ffffff;
    --rd-nav-active: #2f5b70;
    --rd-nav-hover: rgba(255, 255, 255, 0.08);
    --rd-surface: #ffffff;
    --rd-surface-2: #f5f8fa;
    --rd-surface-3: #e9eff3;
    --rd-border: #e0e7ec;
    --rd-border-strong: #cad6de;
    --rd-fg: #18262f;
    --rd-fg-2: #3b4d59;
    --rd-muted: #67798a;
    --rd-brand: #2c5a72;
    --rd-brand-soft: #e4eef3;
    --rd-accent: #5b9db7;
    --rd-accent-hover: #4a89a3;
    --rd-accent-strong: #2c6780;
    --rd-accent-soft: #e8f3f7;
    --rd-accent-line: #b6d6e2;
    --rd-memo: #fbf3e1;
    --rd-memo-fg: #5a4521;
    --rd-bubble-in: #eef2f5;
    --rd-bubble-out: #e1eef4;
    --rd-selected: #e4eff4;
    --rd-warn: #d4630f;
    --rd-warn-soft: #fdeedf;
    --rd-warn-text: #ad500b;
    --rd-on-warn: #ffffff;
    --rd-ok: #187f55;
    --rd-ok-soft: #ddf3e8;
    --rd-info: #2c5fbf;
    --rd-info-soft: #e3ebfa;
    --rd-danger: #b42318;
    --rd-danger-soft: #fdecec;
    --rd-scrim: rgba(8, 14, 26, 0.45);
    --rd-shadow: 0 10px 28px rgba(20, 34, 60, 0.14);
    --rd-font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "LINE Seed JP", "Yu Gothic UI", "Meiryo", sans-serif;
}

/* ---------- 単体ページの土台 ---------- */
.rd-admin-page {
    margin: 0;
    background: var(--rd-surface);
    color: var(--rd-fg);
    font-family: var(--rd-font);
    font-size: 14px;
    line-height: 1.6;
}
.rd-admin-page *, .rd-admin-page *::before, .rd-admin-page *::after { box-sizing: border-box; }
:where(.rd-admin-page) :where(button, input, select, textarea) { font: inherit; color: inherit; }
.rd-admin-page :focus-visible { outline: 2px solid var(--rd-accent); outline-offset: 2px; }

.rd-standalone-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 64px;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(24px, env(safe-area-inset-left, 0px));
    background: var(--rd-surface);
    border-bottom: 1px solid var(--rd-border);
}
.rd-standalone-header h1 { margin: 0; font-size: 20px; font-weight: bold; }
.rd-standalone-links { display: flex; align-items: center; gap: 16px; }
.rd-standalone-links a { color: var(--rd-muted); font-size: 13px; text-decoration: none; font-weight: bold; }
.rd-standalone-links a:hover { color: var(--rd-accent-strong); }
.is-embedded .rd-standalone-header { display: none; }

.rd-page { max-width: 1180px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
.is-embedded .rd-page { padding-top: 20px; }

.rd-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.rd-toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rd-lead { margin: 0; font-size: 13px; color: var(--rd-muted); }

/* ---------- 部品 ---------- */
.rd-card { background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 12px; padding: 20px; }
.rd-card-title { margin: 0 0 12px; font-size: 16px; font-weight: bold; color: var(--rd-fg); }
.rd-section-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rd-section-row h2 { margin: 0; font-size: 16px; font-weight: bold; }
.rd-count { font-size: 13px; color: var(--rd-muted); }

.rd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.rd-btn svg { flex-shrink: 0; }
.rd-btn-accent { background: var(--rd-accent); color: #ffffff; }
.rd-btn-accent:hover { background: var(--rd-accent-hover); }
.rd-btn-accent:disabled { background: #b8c4d4; cursor: not-allowed; }
.rd-btn-outline { background: var(--rd-surface); color: var(--rd-accent-strong); border-color: var(--rd-accent); }
.rd-btn-outline:hover { background: var(--rd-accent-soft); }
.rd-btn-ghost { background: var(--rd-surface); color: var(--rd-fg-2); border-color: var(--rd-border-strong); }
.rd-btn-ghost:hover { background: var(--rd-surface-2); }
.rd-btn-danger { background: var(--rd-surface); color: var(--rd-danger); border-color: #f1b5b0; }
.rd-btn-danger:hover { background: var(--rd-danger-soft); }
.rd-btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.rd-icon-btn {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--rd-fg-2);
    cursor: pointer;
}
.rd-icon-btn:hover { background: var(--rd-surface-3); }
.rd-icon-sm { width: 32px; height: 32px; }

.rd-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--rd-border);
    border-radius: 9px;
    background: var(--rd-surface);
    color: var(--rd-fg-2);
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    cursor: pointer;
}
.rd-tool-btn:hover { background: var(--rd-surface-2); }
.rd-tool-btn[aria-pressed="true"] { border-color: var(--rd-accent-line); background: var(--rd-accent-soft); color: var(--rd-accent-strong); }

.rd-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.rd-field > span, .rd-label { font-size: 13px; font-weight: bold; color: var(--rd-fg-2); }
.rd-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--rd-border-strong);
    border-radius: 10px;
    background: var(--rd-surface);
    color: var(--rd-fg);
    font-size: 14px;
    outline: none;
}
.rd-input::placeholder { color: var(--rd-muted); }
.rd-input:focus { border-color: var(--rd-accent); box-shadow: 0 0 0 3px var(--rd-accent-soft); }
.rd-textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.rd-select { position: relative; display: inline-block; }
.rd-select select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 9px 36px 9px 12px;
    border: 1px solid var(--rd-border-strong);
    border-radius: 10px;
    background: var(--rd-surface);
    color: var(--rd-fg);
    font-size: 14px;
}
.rd-select select:focus { outline: none; border-color: var(--rd-accent); box-shadow: 0 0 0 3px var(--rd-accent-soft); }
.rd-select svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--rd-muted); }

.rd-seg-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.rd-seg-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--rd-fg-2);
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    cursor: pointer;
}
.rd-seg-tab:hover { background: var(--rd-surface-2); }
.rd-seg-tab[aria-selected="true"] { background: var(--rd-brand-soft); color: var(--rd-brand); }
.rd-seg-count { font-variant-numeric: tabular-nums; color: var(--rd-muted); }
.rd-seg-tab[aria-selected="true"] .rd-seg-count { color: var(--rd-brand); }

.rd-search { position: relative; display: flex; align-items: center; gap: 8px; min-width: 240px; flex: 1; max-width: 360px; }
.rd-search .rd-input { background: var(--rd-surface-2); border-color: var(--rd-border); }

.rd-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: bold; white-space: nowrap; }
.rd-badge-warn { background: var(--rd-warn-soft); color: var(--rd-warn-text); }
.rd-badge-ok { background: var(--rd-ok-soft); color: var(--rd-ok); }
.rd-badge-info { background: var(--rd-info-soft); color: var(--rd-info); }
.rd-badge-muted { background: var(--rd-surface-3); color: var(--rd-fg-2); }
.rd-badge-accent { background: var(--rd-accent-soft); color: var(--rd-accent-strong); }
.rd-badge-danger { background: var(--rd-danger-soft); color: var(--rd-danger); }

.rd-empty { padding: 40px 20px; text-align: center; color: var(--rd-muted); font-size: 14px; border: 1px dashed var(--rd-border-strong); border-radius: 12px; background: var(--rd-surface); }

.rd-table-wrap { width: 100%; overflow-x: auto; }
.rd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rd-table th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: bold; color: var(--rd-muted); border-bottom: 1px solid var(--rd-border); white-space: nowrap; }
.rd-table td { padding: 12px 14px; border-bottom: 1px solid var(--rd-border); vertical-align: middle; color: var(--rd-fg); }
.rd-table tr:hover td { background: var(--rd-surface-2); }

.rd-modal-backdrop { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 20px; background: var(--rd-scrim); }
.rd-modal { width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; padding: 24px; background: var(--rd-surface); border-radius: 16px; box-shadow: var(--rd-shadow); }
.rd-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.rd-modal-head h2, .rd-modal-head h3 { margin: 0; font-size: 18px; font-weight: bold; }
.rd-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.rd-toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 2000;
    max-width: calc(100vw - 32px);
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--rd-fg);
    color: #ffffff;
    font-size: 13.5px;
    box-shadow: var(--rd-shadow);
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.rd-toast.show { opacity: 1; transform: translate(-50%, 0); }
.rd-toast.is-error { background: var(--rd-danger); }

@media (max-width: 640px) {
    .rd-standalone-header { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
    .rd-search { max-width: none; min-width: 0; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .rd-toast { transition: none; }
}
