/* LIMA ポータル */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1f2328;
  --ink-2: #57606a;
  --line: #d8dde3;
  --accent: #f3e45a;       /* スタッフメニューの強調（構成図の黄色） */
  --accent-ink: #3d3800;
  --primary: #2b3440;
  --primary-ink: #ffffff;
  --danger: #b42318;
  --ok-bg: #ecf8ef; --ok-line: #9fd8ad;
  --err-bg: #fdecea; --err-line: #f1a9a0;
  --radius: 10px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); line-height: 1.6; font-size: 15px; }
a { color: #1f5fbf; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: #eef1f4; padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- ボタン・フォーム */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f0f2f4; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .nav-item:focus-visible, summary:focus-visible { outline: 3px solid #8ab4f8; outline-offset: 1px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #3b4655; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #e7b4ae; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: #1f5fbf; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.field { display: grid; gap: 4px; margin: 0 0 14px; border: 0; padding: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; }
input[type=text], input[type=password], select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.radio, .check { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; cursor: pointer; }
.form-error { background: var(--err-bg); border: 1px solid var(--err-line); color: #8a1c12; padding: 8px 12px; border-radius: 8px; font-size: 14px; }

/* ---------- ログイン画面 */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #eceef1 0%, #f7f8f9 100%); }
.auth-top { display: flex; justify-content: flex-end; padding: 16px 20px; }
.auth-switch { font-size: 13px; color: var(--ink-2); text-decoration: none; padding: 6px 12px; border: 1px solid transparent; border-radius: 999px; }
.auth-switch:hover { border-color: var(--line); background: #fff; color: var(--ink); }
.auth-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 16px 12vh; }
.auth-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 22px; }
.brand-sub { font-size: 13px; letter-spacing: .12em; color: var(--ink-2); }
.brand-main { font-size: 34px; font-weight: 800; letter-spacing: .2em; padding-left: .2em; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 28px 20px; box-shadow: 0 8px 24px rgba(31,35,40,.06); }
.auth-card h1 { font-size: 18px; margin: 0 0 18px; text-align: center; }
.auth-card { position: relative; overflow: hidden; }
/* スタッフログインの印（上の黄色い帯） */
.auth-card.is-staff::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--accent); }
.brand-logo { display: block; width: 220px; height: auto; }
/* ---- 表示時のアニメーション（約1秒）。入力はすぐできる（見た目だけ） */
/* ロゴ: 左から右へ現れる（ぼかし → くっきり・わずかに縮む） */
.is-intro .brand-logo { animation: lima-logo .7s cubic-bezier(.2,.8,.2,1) both; }
/* 入力欄を含む枠は最初から見せる（どこにカーソルがあるか分かるように）。少し下・やや薄い所から上がるだけ */
.is-intro .auth-card { animation: lima-rise .6s cubic-bezier(.2,.8,.2,1) both; }
.is-intro .auth-card.is-staff::before { transform-origin: center; animation: lima-bar .35s .65s cubic-bezier(.65,0,.35,1) both; }
.auth-top.is-intro-top { animation: lima-fade .5s .45s ease both; }
@keyframes lima-logo { from { clip-path: inset(0 100% 0 0); filter: blur(6px); transform: scale(1.04); } to { clip-path: inset(0 0 0 0); filter: none; transform: none; } }
@keyframes lima-rise { from { opacity: .55; transform: translateY(12px); box-shadow: 0 0 0 rgba(31,35,40,0); } to { opacity: 1; transform: none; } }
@keyframes lima-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lima-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .is-intro *, .is-intro *::before, .is-intro *::after, .auth-top.is-intro-top { animation: none !important; }
}
.auth-note { font-size: 12px; color: var(--ink-2); text-align: center; margin: 14px 0 0; }

/* ---------- スタッフ画面（左メニュー） */
.staff-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #20262e; color: #e8ecf0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; flex-direction: column; padding: 22px 22px 18px; border-bottom: 1px solid #333b45; }
.sidebar-brand .brand-sub { color: #9aa5b1; font-size: 11px; }
.sidebar-logo { display: block; width: 150px; height: auto; }
.client-logo { display: block; height: 36px; width: auto; }
.sidebar-brand .brand-main { font-size: 24px; letter-spacing: .18em; padding-left: 0; color: #fff; }
.sidebar-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; color: #d6dce2; text-decoration: none; font-size: 14px; }
.nav-item:hover { background: #2c343e; color: #fff; }
.nav-item.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.nav-item .ext { font-size: 12px; opacity: .7; }
.nav-sep { height: 1px; background: #333b45; margin: 10px 6px; }
.sidebar-foot { border-top: 1px solid #333b45; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-foot .btn { color: #d6dce2; border-color: #46505c; }
.sidebar-foot .btn:hover { background: #2c343e; }
.me { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-id { font-size: 11px; color: #9aa5b1; }
.staff-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px; }
.page-title { font-size: 20px; margin: 0; }
.menu-toggle { display: none; }
.content { padding: 12px 28px 40px; max-width: 1200px; width: 100%; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 6px; font-size: 18px; }
.placeholder .badge { display: inline-block; background: #fff6c2; color: #5c5100; border: 1px solid #ecd96a; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin: 0 0 10px; }
.badge-info { background: #e7f0fd !important; color: #1f4d99 !important; border-color: #b6cdf2 !important; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.flash-error { background: var(--err-bg); border-color: var(--err-line); color: #8a1c12; }
.onetime { margin-top: 10px; padding: 10px 12px; background: #fff; border: 1px dashed #9fd8ad; border-radius: 8px; color: var(--ink); }
.onetime p { margin: 0 0 6px; font-size: 13px; }
.onetime-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.onetime code { font-size: 18px; letter-spacing: .06em; padding: 4px 10px; }
.lead { margin: 0 0 14px; font-size: 14px; }

/* ---------- タブ・表 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { padding: 9px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-size: 14px; font-weight: 600; }
.tab.is-active { color: var(--ink); border-bottom-color: var(--primary); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid #eceff2; vertical-align: top; }
.table th { font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.table-compact td { padding: 7px 10px; }
.table tr.is-disabled td { color: #8c959f; }
.th-actions, .td-actions { width: 1%; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #eef1f4; color: var(--ink-2); font-weight: 600; }
.tag-strong { background: #fff6c2; color: #5c5100; }
.tag-warn { background: #fdecea; color: #8a1c12; }
.actions { position: relative; }
.actions > summary { list-style: none; }
.actions > summary::-webkit-details-marker { display: none; }
.actions-body { position: absolute; right: 0; z-index: 5; margin-top: 6px; width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(31,35,40,.12); padding: 14px; white-space: normal; display: grid; gap: 12px; }
.mini-form { display: grid; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid #eceff2; }
.mini-form .field { margin-bottom: 8px; }
.mini-form input, .mini-form select { padding: 7px 10px; font-size: 14px; }
.mini-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-grid { max-width: 520px; }

/* ---------- クライアント画面 */
.client-body { min-height: 100vh; }
.client-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.client-header .brand b { letter-spacing: .15em; }
.client-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.client-user form { margin: 0; }
.client-main { max-width: 960px; margin: 0 auto; padding: 28px 16px; }

/* ---------- 埋め込み表示（スタッフ画面の右側） */
.nav-short { display: none; }
.collapse-btn { margin-left: auto; background: transparent; border: 1px solid #46505c; color: #d6dce2; border-radius: 8px; width: 32px; height: 30px; cursor: pointer; font: inherit; font-size: 15px; line-height: 1; }
.collapse-btn:hover { background: #2c343e; }
.sidebar-foot { flex-wrap: wrap; }
.is-shell .staff-main { height: 100vh; }
.is-shell .topbar { display: none; }
.is-shell .content { padding: 0; max-width: none; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panes { position: relative; flex: 1; min-height: 0; }
.pane { display: none; width: 100%; height: 100%; }
.pane.is-active { display: block; }
.pane-frame { border: 0; background: #fff; }
.pane-placeholder { padding: 28px; overflow: auto; }

/* 折りたたみ（アイコン幅の細いメニュー） */
.nav-collapsed .staff-shell { grid-template-columns: 76px minmax(0, 1fr); }
.nav-collapsed .sidebar-brand { padding: 18px 8px 14px; align-items: center; }
.nav-collapsed .sidebar-brand .brand-sub, .nav-collapsed .nav-label, .nav-collapsed .nav-item .ext, .nav-collapsed .me { display: none; }
.nav-collapsed .sidebar-brand .brand-main { font-size: 15px; letter-spacing: .08em; }
.nav-collapsed .sidebar-logo { width: 52px; }
.nav-collapsed .sidebar-nav { padding: 10px 6px; }
.nav-collapsed .nav-item { justify-content: center; padding: 10px 4px; }
.nav-collapsed .nav-short { display: inline; font-size: 12px; font-weight: 700; text-align: center; }
.nav-collapsed .sidebar-foot { flex-direction: column; padding: 10px 6px; }
.nav-collapsed .sidebar-foot .btn { padding: 5px 4px; font-size: 10px; white-space: nowrap; letter-spacing: -.02em; }
.nav-collapsed .collapse-btn { margin: 0; transform: rotate(180deg); }

/* クライアント画面（エルメを全面に表示） */
.client-body.is-embed { height: 100vh; display: flex; flex-direction: column; }
.is-embed .client-header { padding: 8px 20px; }
.is-embed .client-main { max-width: none; width: 100%; padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.client-frame { flex: 1; width: 100%; border: 0; display: block; }

/* クライアント画面のレポート切り替え（公式LINE / 広告） */
.client-tabs { display: flex; align-items: center; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.client-tab { padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.client-tab.is-active { color: var(--ink); border-bottom-color: var(--primary); }
.client-subtabs { display: flex; gap: 6px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.client-subtab { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.client-subtab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- スマホ幅 */
@media (max-width: 860px) {
  .staff-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; z-index: 50; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-toggle { display: inline-flex; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
  .topbar { padding: 14px 16px 4px; }
  .page-title { font-size: 17px; }
  .content { padding: 10px 16px 32px; }
  .panel { padding: 16px; }
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid #eceff2; padding: 8px 0; }
  .table td { display: flex; gap: 10px; border: 0; padding: 3px 0; }
  .table td[data-label]::before { content: attr(data-label); flex: 0 0 100px; color: var(--ink-2); font-size: 12px; }
  .td-actions { width: auto; }
  .actions-body { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .client-header { padding: 12px 16px; }
  .is-shell .topbar { display: flex; }
  .collapse-btn { display: none; }
  .nav-collapsed .staff-shell { grid-template-columns: 1fr; }
}
