/* ============================================================
   MEGRIA（MEGRIA）エステサロン管理システム モック
   デザイン言語「凛と（Rinto）」— 藤紫 × 金茶 に振り直し
   ============================================================ */

:root {
  /* Brand Colors (HSM Red 基調) */
  --c-primary:        #8B6F5C;  /* 藤紫（MEGRIAブランドカラー） */
  --c-primary-dark:   #6D5548;  /* ホバー時 */
  --c-primary-soft:   #F5EDE4;  /* 藤紫 100 */
  --c-primary-mid:    #DCC9B4;  /* 藤紫 300 */

  /* Sub Accent (Deep Navy for serious contrast) */
  --c-accent:         #A98352;  /* 金茶 — テキスト・薄地・線用 */
  --c-accent-deep:    #856439;  /* 金茶（白文字を載せる面用・4.5:1以上） */
  --c-accent-soft:    #F6EFE3;

  /* Neutral */
  --c-ink-900:        #0F172A;  /* Slate 900 */
  --c-ink-700:        #334155;  /* Slate 700 */
  --c-ink-500:        #5A6577;  /* Slate 500 をやや暗く（薄地の上でも4.5:1を満たす） */
  --c-ink-300:        #CBD5E1;  /* Slate 300 */
  --c-line:           #E2E8F0;  /* Slate 200 */
  --c-line-soft:      #F1F5F9;  /* Slate 100 */
  --c-bg:             #F8FAFC;  /* Slate 50 */
  --c-surface:        #FFFFFF;

  /* Semantic */
  --c-ok:             #059669;  /* Emerald 600 */
  --c-ok-soft:        #D1FAE5;
  --c-warn:           #D97706;  /* Amber 600 */
  --c-warn-soft:      #FEF3C7;
  --c-err:            #DC2626;  /* Red 600 */
  --c-err-soft:       #FEE2E2;
  --c-info:           #0284C7;  /* Sky 600 */
  --c-info-soft:      #E0F2FE;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

  /* Radius
     ★ 公開サイト（site.css）は rinto を読まないので、同じ値を持っている（#58 141番）。
       **変えるときは site.css の --r-sm / --r-md / --r-lg / --r-pill も直す。** */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --sh-2: 0 4px 6px rgba(15,23,42,.04), 0 10px 15px rgba(15,23,42,.08);
  --sh-3: 0 10px 15px rgba(15,23,42,.06), 0 20px 40px rgba(15,23,42,.12);
  --sh-brand: 0 4px 12px rgba(139,111,92,.25), 0 0 0 1px rgba(139,111,92,.1);

  /* Typography */
  --fs-xs: 14.5px;
  --fs-sm: 15.5px;
  --fs-base: 17px;
  --fs-md: 19.5px;
  --fs-lg: 22px;
  --fs-xl: 26px;
  --fs-2xl: 32px;
  --fs-3xl: 44px;

  /* Layout */
  --sidebar-w: 300px;
  --topbar-h: 86px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--c-ink-900);
  letter-spacing: .012em;
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; }

/* ===== Layout Shell ===== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--c-line);
  transition: background .15s;
}
a.sidebar__brand:hover { background: var(--c-line-soft); }
.sidebar__logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--c-primary);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 19.5px; letter-spacing: .02em;
  box-shadow: var(--sh-brand);
}
.sidebar__title { font-weight: 800; font-size: var(--fs-md); letter-spacing: -.01em; line-height: 1.2; }
.sidebar__title small { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: .14em; color: var(--c-ink-500); margin-top: 4px; }

.sidebar__nav { padding: 16px 14px; flex: 1; overflow-y: auto; }
.sidebar__section { font-size: 14.5px; font-weight: 700; color: var(--c-ink-500); letter-spacing: .12em; padding: 22px 16px 12px; text-transform: uppercase; }
.sidebar__section:first-child { padding-top: 6px; }
.sidebar__link {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  margin-bottom: 3px;
  border-radius: var(--r-md);
  color: var(--c-ink-700);
  font-size: 18px; font-weight: 500;
  letter-spacing: -.01em;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar__link:last-child { margin-bottom: 0; }
.sidebar__link .material-symbols-outlined { font-size: 26px; }
.sidebar__link:hover { background: var(--c-line-soft); color: var(--c-ink-900); }
.sidebar__link.is-active { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 700; }
.sidebar__link.is-active::before {
  content:""; position:absolute; left:0; top:8px; bottom:8px; width:3px;
  background: var(--c-primary); border-radius: 0 2px 2px 0;
}
.sidebar__link.is-active .material-symbols-outlined {
  font-variation-settings: "FILL" 1;
}
.sidebar__link .badge-count {
  margin-left: auto;
  background: var(--c-primary);
  color: #fff;
  font-size: 12.5px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-pill);
  min-width: 20px; text-align: center;
  line-height: 1.4;
}

.sidebar__user {
  padding: 18px 22px;
  border-top: 1px solid var(--c-line);
  display: flex; align-items: center; gap: 12px;
}
.sidebar__user-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c-accent-deep);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
  flex-shrink: 0;
}
.sidebar__user > div:nth-child(2) { flex: 1; min-width: 0; }
.sidebar__user-name { font-size: var(--fs-base); font-weight: 700; line-height: 1.3; }
.sidebar__user-role { font-size: 14.5px; color: var(--c-ink-500); margin-top: 2px; }
.sidebar__user-logout {
  width: 44px; height: 44px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--c-ink-500);
  transition: all .15s;
  flex-shrink: 0;
}
.sidebar__user-logout:hover { background: var(--c-err-soft); color: var(--c-err); }
.sidebar__user-logout .material-symbols-outlined { font-size: 24px; }

/* ===== Main ===== */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--c-line);
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 32px;
  gap: 18px;
  position: sticky; top: 0; z-index: 10;
}
.topbar__heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* ★ 見出しは**1行に収めて、入らないぶんは「…」**にする（2026-09-10）。
     帯の高さは決め打ち（--topbar-h）なので、折り返すと外へはみ出す。
     タブレットの幅で会員のお名前が1文字ずつ縦に折り返し、右の操作にも
     かぶっていた。切れても読めるが、崩れると読めない。 */
.topbar__title {
  font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__crumb {
  font-size: 13.5px; color: var(--c-ink-500); font-weight: 600; letter-spacing: .08em; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__spacer { flex: 1; }
/* ★ 操作のボタンは**縮めない。**縮むと文字が折り返して帯からはみ出す。
     狭いときに削るのは見出しの側（上の「…」）。 */
.topbar__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.content { padding: 28px 32px 80px; width: 100%; }

/* 常時表示させたい警告（禁忌・アレルギーなど）をトップバー直下に固定する */
.alert--sticky {
  position: sticky; top: calc(var(--topbar-h) + 0px); z-index: 8;
  box-shadow: 0 4px 10px rgba(15,23,42,.06);
}

/* 文中に置くテキストリンク（タップ領域を44px確保する） */
.tlink{display:inline-flex;align-items:center;gap:4px;min-height:44px;padding:0 4px;
  color:var(--c-primary);font-weight:700;text-decoration:underline;text-underline-offset:3px;}
.tlink:hover{color:var(--c-primary-dark);}

/* ===== Components ===== */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 700;
  transition: all .15s;
  border: 1.5px solid transparent;
  min-height: 46px;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn .material-symbols-outlined { font-size: 22px; }
.btn--primary {
  background: var(--c-primary); color: #fff;
  box-shadow: var(--sh-1);
}
.btn--primary:hover { background: var(--c-primary-dark); transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn--outline {
  background: #fff; color: var(--c-ink-700);
  border-color: var(--c-line);
}
.btn--outline:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn--text { color: var(--c-ink-700); padding: 8px 12px; min-height: auto; font-weight: 600; }
.btn--text:hover { background: var(--c-line-soft); color: var(--c-primary); }
.btn--ghost { background: var(--c-line-soft); color: var(--c-ink-700); }
.btn--ghost:hover { background: var(--c-line); }
.btn--danger { background: var(--c-err); color: #fff; }
.btn--sm { padding: 8px 16px; font-size: var(--fs-xs); min-height: 44px; gap: 4px; }
.btn--sm .material-symbols-outlined { font-size: 20px; }
.btn--lg { padding: 14px 28px; font-size: var(--fs-base); min-height: 54px; }
.btn--icon { padding: 0; min-height: 44px; width: 44px; justify-content: center; }
.btn--icon .material-symbols-outlined { font-size: 24px; }

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--sh-1);
}
.card--flat { box-shadow: none; }
.card--brand {
  background: linear-gradient(135deg, #fff 0%, #FEF2F2 100%);
  border-color: rgba(189,0,41,.15);
}
.card__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.card__title {
  font-size: var(--fs-md); font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  margin: 0;
  letter-spacing: -.01em;
}
.card__title .material-symbols-outlined { color: var(--c-primary); font-size: 26px; }

/* Stat Card */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--sh-1);
  display: flex; align-items: center; gap: 18px;
  transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stat__icon {
  width: 56px; height: 56px; border-radius: var(--r-md);
  background: var(--c-primary-soft); color: var(--c-primary);
  display: grid; place-items: center; flex-shrink: 0;
}
.stat__icon .material-symbols-outlined { font-size: 30px; }
.stat__icon--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.stat__icon--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.stat__icon--info { background: var(--c-info-soft); color: var(--c-info); }
.stat__num { font-size: 37px; font-weight: 800; color: var(--c-ink-900); line-height: 1; letter-spacing: -.02em; }
.stat__num small { font-size: var(--fs-base); font-weight: 700; margin-left: 3px; color: var(--c-ink-500); }
.stat__label { font-size: var(--fs-sm); color: var(--c-ink-500); font-weight: 600; margin-top: 6px; }
.stat__delta { font-size: 13.5px; font-weight: 700; margin-top: 4px; }
.stat__delta--up { color: var(--c-ok); }
.stat__delta--down { color: var(--c-err); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px;
  font-size: 14.5px; font-weight: 700;
  border-radius: var(--r-pill);
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge--ok      { background: var(--c-ok-soft); color: #046C4E; }
.badge--warn    { background: var(--c-warn-soft); color: #8A5A05; }
.badge--err     { background: var(--c-err-soft); color: #9B1C1C; }
.badge--info    { background: var(--c-info-soft); color: #075E88; }
.badge--draft   { background: var(--c-line-soft); color: var(--c-ink-500); }
.badge--brand   { background: var(--c-primary-soft); color: var(--c-primary); }

/* Category Tag */
.cat-tag {
  display: inline-flex; align-items: center;
  padding: 5px 12px;
  font-size: 14.5px; font-weight: 700;
  border-radius: var(--r-sm);
  letter-spacing: .02em;
  white-space: nowrap;
}
.cat-tag--news     { background: #DBEAFE; color: #1E40AF; }
.cat-tag--recruit  { background: #DCFCE7; color: #15803D; }
.cat-tag--works    { background: #FEF3C7; color: #92400E; }
.cat-tag--region   { background: #F3E8FF; color: #6B21A8; }

/* List item (お知らせ等の行) */
.list-item {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--c-line);
  transition: background .15s;
}
.list-item:last-child { border-bottom: 0; }
.list-item__meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; min-width: 210px; }
.list-item__date { font-size: 15.5px; color: var(--c-ink-500); font-weight: 600; font-variant-numeric: tabular-nums; }
.list-item__title { flex: 1; font-size: var(--fs-base); font-weight: 600; color: var(--c-ink-900); line-height: 1.55; }
.list-item__action { color: var(--c-ink-500); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.list-item__action .material-symbols-outlined { font-size: 22px; }
.list-item:hover .list-item__action { color: var(--c-primary); background: var(--c-primary-soft); }

/* Inquiry item */
.inquiry-item {
  display: flex; gap: 12px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--c-line-soft);
  border-left: 3px solid var(--c-line);
  transition: all .15s;
}
.inquiry-item--unread { border-left-color: var(--c-primary); background: #fff; border: 1px solid var(--c-line); border-left: 3px solid var(--c-primary); }
.inquiry-item__avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--c-accent-soft); color: var(--c-accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 16.5px;
  flex-shrink: 0;
}
.inquiry-item__body { flex: 1; min-width: 0; }
.inquiry-item__name { font-size: var(--fs-base); font-weight: 700; line-height: 1.4; }
.inquiry-item__name .unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); margin-left: 6px; vertical-align: middle; }
.inquiry-item__subject { font-size: 15.5px; color: var(--c-ink-700); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-item__time { font-size: 13.5px; color: var(--c-ink-500); margin-top: 6px; font-weight: 600; }

/* ============================================================
   Login Page
   ============================================================ */
body.login-page { background: #0F172A; min-height: 100vh; }
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* Left: Brand */
.login-brand {
  position: relative;
  background:
    radial-gradient(circle at 20% 20%, rgba(189,0,41,.55) 0%, transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(30,58,138,.4) 0%, transparent 55%),
    linear-gradient(135deg, #1A0510 0%, #0F172A 60%, #1E293B 100%);
  color: #fff;
  display: flex; flex-direction: column;
  padding: 56px 64px;
  overflow: hidden;
}
.login-brand::before {
  content:"";
  position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.login-brand__inner { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.login-brand__logo {
  display: inline-flex; align-items: center; gap: 16px;
  margin-bottom: 40px;
}
.login-brand__mark {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--c-primary);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 24px;
  letter-spacing: .04em;
  box-shadow: 0 10px 30px rgba(189,0,41,.5), 0 0 0 1px rgba(255,255,255,.08);
}
.login-brand__company {
  font-size: 15.5px; font-weight: 600; opacity: .7; letter-spacing: .14em;
  text-transform: uppercase;
}
.login-brand__name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin-top: 4px; }
.login-brand__catch {
  font-size: 45px; font-weight: 800; line-height: 1.3;
  letter-spacing: -.02em;
  margin-bottom: 18px;
}
.login-brand__catch strong { color: var(--c-primary-mid); }
.login-brand__lead {
  font-size: 17px; line-height: 1.8; opacity: .8;
  max-width: 420px;
}
.login-brand__divider {
  width: 60px; height: 4px; border-radius: 2px;
  background: var(--c-primary);
  margin: 32px 0;
}
.login-brand__features {
  display: flex; flex-direction: column; gap: 14px;
  margin-top: 28px;
}
.login-brand__feature {
  display: flex; align-items: center; gap: 12px;
  font-size: 16.5px; font-weight: 500;
  opacity: .85;
}
.login-brand__feature .material-symbols-outlined {
  font-size: 24px; color: var(--c-primary-mid);
}
.login-brand__footer {
  position: relative; z-index: 1;
  font-size: 13.5px; opacity: .5;
  letter-spacing: .04em;
}

/* Right: Form */
.login-form {
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  background: #fff;
}
.login-form__inner { width: 100%; max-width: 440px; }
.login-form__title {
  font-size: 32px; font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 8px;
}
.login-form__sub {
  font-size: 16.5px; color: var(--c-ink-500);
  margin: 0 0 36px;
  line-height: 1.7;
}
.login-form .field + .field { margin-top: 20px; }
.login-form__pwd { position: relative; }
.login-form__pwd-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--c-ink-500);
  transition: background .15s, color .15s;
}
.login-form__pwd-toggle:hover { background: var(--c-line-soft); color: var(--c-ink-700); }
.login-form__pwd .input { padding-right: 52px; }

.login-form__options {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 0 28px;
}
.login-form__remember {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15.5px; font-weight: 600; color: var(--c-ink-700);
  cursor: pointer;
}
.login-form__remember input {
  width: 18px; height: 18px; accent-color: var(--c-primary);
}
.login-form__forgot {
  font-size: 15.5px; font-weight: 600;
  color: var(--c-primary);
}
.login-form__forgot:hover { text-decoration: underline; }
.login-form__submit {
  width: 100%;
  justify-content: center;
  min-height: 56px;
  font-size: 17px;
}
.login-form__notice {
  margin-top: 28px;
  padding: 14px 16px;
  background: var(--c-line-soft);
  border-radius: var(--r-md);
  font-size: 14.5px; line-height: 1.7;
  color: var(--c-ink-700);
  display: flex; align-items: flex-start; gap: 10px;
}
.login-form__notice .material-symbols-outlined { color: var(--c-info); font-size: 24px; flex-shrink: 0; }
.login-form__alert {
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--c-err-soft);
  border: 1px solid rgba(220,38,38,.2);
  border-left: 3px solid var(--c-err);
  border-radius: var(--r-md);
  font-size: 15.5px; color: var(--c-err);
  display: flex; align-items: flex-start; gap: 10px;
  font-weight: 600;
}
.login-form__alert .material-symbols-outlined { font-size: 24px; flex-shrink: 0; }

/* Responsive */
@media (max-width: 1024px) {
  .login-brand { padding: 48px 44px; }
  .login-brand__catch { font-size: 37px; }
  .login-form { padding: 40px 32px; }
}
@media (max-width: 768px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 36px 24px; min-height: auto; }
  .login-brand__catch { font-size: 28px; }
  .login-brand__lead { font-size: 15.5px; }
  .login-brand__divider { margin: 22px 0; }
  .login-brand__features { display: none; }
  .login-form { padding: 32px 24px; }
  .login-form__title { font-size: 26px; }
}

/* ===== Page Header (一覧ページの上部) ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header__desc { font-size: 16.5px; color: var(--c-ink-500); margin-top: 4px; line-height: 1.6; }

/* ===== Filter Bar ===== */
.filter-bar {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.filter-bar__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-bar__label { font-size: 15.5px; font-weight: 700; color: var(--c-ink-500); letter-spacing: .04em; min-width: 70px; }

/* Chips (filter tabs) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-pill);
  background: #fff;
  font-size: 16.5px; font-weight: 600;
  color: var(--c-ink-700);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.chip.is-active {
  background: var(--c-primary); border-color: var(--c-primary); color: #fff;
}
.chip__count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-line-soft);
  color: var(--c-ink-500);
  font-size: 13.5px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-pill);
  margin-left: 4px;
  min-width: 20px;
  line-height: 1.4;
}
.chip.is-active .chip__count { background: rgba(255,255,255,.25); color: #fff; }

/* Search */
.search {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: #fff;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  height: 48px;
  min-width: 280px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(189,0,41,.12); }
.search .material-symbols-outlined { color: var(--c-ink-500); font-size: 24px; }
.search input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-size: 16.5px;
}

/* Select (filter) */
.select-mini {
  height: 48px;
  padding: 0 38px 0 16px;
  font: inherit; font-size: 16.5px; font-weight: 600;
  color: var(--c-ink-900);
  background: #fff;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.select-mini:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(189,0,41,.12); }

/* ===== Data Table ===== */
.data-table-wrap {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 17px; }
.data-table thead th {
  background: var(--c-line-soft);
  text-align: left;
  padding: 16px 20px;
  font-size: 15.5px; font-weight: 700; color: var(--c-ink-500);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
}
.data-table thead th.is-sortable { cursor: pointer; }
.data-table thead th.is-sortable:hover { color: var(--c-ink-700); }
.data-table tbody td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--c-line);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--c-primary-soft); }
.data-table .col-date { font-variant-numeric: tabular-nums; color: var(--c-ink-700); font-weight: 700; font-size: 17px; width: 130px; white-space: nowrap; }
.data-table .col-cat { width: 140px; white-space: nowrap; }
.data-table .col-status { width: 110px; white-space: nowrap; }
.data-table .col-views { width: 110px; text-align: right; font-variant-numeric: tabular-nums; color: var(--c-ink-500); font-weight: 600; font-size: 16.5px; white-space: nowrap; }
.data-table .col-actions { width: 70px; text-align: right; }
.data-table .row-title { font-weight: 600; color: var(--c-ink-900); line-height: 1.55; font-size: 17px; letter-spacing: 0; }
.data-table .row-title small { display: block; font-size: 14.5px; color: var(--c-ink-500); font-weight: 500; margin-top: 5px; }

/* Row with thumbnail (実績一覧用) */
.row-thumb {
  width: 80px; height: 56px; border-radius: 6px;
  background: var(--c-line-soft);
  display: grid; place-items: center;
  color: var(--c-ink-500);
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--c-line);
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-with-thumb { display: flex; align-items: center; gap: 14px; }
.data-table .col-thumb { width: 96px; }

/* Drag handle (並び替え用) */
.col-drag { width: 36px; text-align: center; }
.drag-handle {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  color: var(--c-ink-300);
  cursor: grab;
}
.drag-handle:hover { color: var(--c-ink-500); }
.drag-handle .material-symbols-outlined { font-size: 24px; }

/* Inquiry status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  font-size: 14.5px; font-weight: 700;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.status-pill::before {
  content:""; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
}
.status-pill--unread { background: var(--c-err-soft); color: var(--c-err); }
.status-pill--working { background: var(--c-warn-soft); color: var(--c-warn); }
.status-pill--done { background: var(--c-ok-soft); color: var(--c-ok); }

/* Reply box */
.reply-box {
  background: var(--c-line-soft);
  border-radius: var(--r-md);
  padding: 16px 18px;
  border-left: 3px solid var(--c-primary);
}
.reply-box__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.reply-box__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-accent-deep); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14.5px;
}
.reply-box__name { font-size: 15.5px; font-weight: 700; }
.reply-box__time { font-size: 13.5px; color: var(--c-ink-500); }
.reply-box__body { font-size: 15.5px; line-height: 1.8; white-space: pre-wrap; }

.row-actions { display: inline-flex; gap: 4px; }
.row-actions button {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--c-ink-500);
  transition: all .15s;
}
.row-actions button .material-symbols-outlined { font-size: 22px; }
.row-actions button:hover { background: var(--c-primary-soft); color: var(--c-primary); }
.row-actions button.is-danger:hover { background: var(--c-err-soft); color: var(--c-err); }

/* ===== Pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-top: 1px solid var(--c-line);
  background: #fff;
  font-size: 15.5px; color: var(--c-ink-500);
}
.pagination__pages { display: inline-flex; gap: 4px; align-items: center; }
.pagination__btn {
  min-width: 40px; height: 40px; padding: 0 12px;
  border-radius: 8px;
  display: inline-grid; place-items: center;
  color: var(--c-ink-700); font-size: 16.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
}
.pagination__btn:hover { background: var(--c-line-soft); }
.pagination__btn.is-active { background: var(--c-primary); color: #fff; }
.pagination__btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Form (詳細/編集ページ) ===== */
.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.form-grid > .form-main { display: flex; flex-direction: column; gap: 16px; }
.form-grid > .form-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 100px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 15.5px; font-weight: 700; color: var(--c-ink-700); }
.field__label .req { color: var(--c-err); margin-left: 4px; font-size: 13.5px; }
.field__hint { font-size: 13.5px; color: var(--c-ink-500); }
.input, .textarea, .select {
  width: 100%;
  padding: 12px 16px;
  font: inherit; font-size: 16.5px;
  color: var(--c-ink-900);
  background: #fff;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
  line-height: 1.5;
}
input.input, select.select { height: 46px; padding-top: 0; padding-bottom: 0; line-height: 46px; }
select.select {
  padding-right: 40px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(189,0,41,.15);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }

/* WYSIWYG mock toolbar */
.wysiwyg {
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  background: #fff;
  overflow: hidden;
}
.wysiwyg:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(189,0,41,.15); }
.wysiwyg__toolbar {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-line-soft);
}
.wysiwyg__btn {
  width: 34px; height: 34px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--c-ink-700);
  transition: background .15s, color .15s;
}
.wysiwyg__btn:hover { background: #fff; color: var(--c-primary); }
.wysiwyg__btn.is-active { background: var(--c-primary-soft); color: var(--c-primary); }
.wysiwyg__btn .material-symbols-outlined { font-size: 22px; }
.wysiwyg__sep { width: 1px; align-self: stretch; background: var(--c-line); margin: 4px 6px; }
.wysiwyg__body {
  min-height: 360px;
  padding: 18px 20px;
  font-size: 16.5px;
  line-height: 1.85;
  outline: none;
}
.wysiwyg__body h2 { font-size: 24px; font-weight: 800; margin: 24px 0 12px; }
.wysiwyg__body h3 { font-size: 19.5px; font-weight: 700; margin: 20px 0 10px; }
.wysiwyg__body p { margin: 0 0 14px; }
.wysiwyg__body img { max-width: 100%; border-radius: 8px; }

/* Image upload */
.image-upload {
  border: 2px dashed var(--c-line);
  border-radius: var(--r-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
}
.image-upload:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.image-upload .material-symbols-outlined { font-size: 40px; color: var(--c-ink-500); }
.image-upload__hint { font-size: 14.5px; color: var(--c-ink-500); margin-top: 6px; }
.image-upload__has-image { padding: 0; border-style: solid; }
.image-upload__has-image img { width: 100%; border-radius: var(--r-md); display: block; }

/* Side panel sections */
.side-section {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.side-section__title {
  font-size: 15.5px; font-weight: 800; color: var(--c-ink-900);
  letter-spacing: .02em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-line);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.side-section__title .material-symbols-outlined { font-size: 22px; color: var(--c-primary); }

/* Radio group */
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .15s;
  font-size: 15.5px; font-weight: 600;
}
.radio-item:hover { border-color: var(--c-primary); }
.radio-item input { accent-color: var(--c-primary); width: 18px; height: 18px; }
.radio-item.is-checked { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }

/* Helpers */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--c-ink-500); }
.text-primary { color: var(--c-primary); }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* ============================================================
   Mobile Header (小画面のみ表示)
   ============================================================ */
.mobile-header {
  display: none;
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--c-line);
  height: 56px;
  padding: 0 12px;
  align-items: center;
  gap: 8px;
}
.mobile-header__menu {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--c-ink-700);
}
.mobile-header__menu:active { background: var(--c-line-soft); }
.mobile-header__brand {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.mobile-header__logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--c-primary);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 14.5px;
  flex-shrink: 0;
}
.mobile-header__title {
  font-weight: 800; font-size: 16.5px; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mobile-header__action {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--c-ink-700);
}

.drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 90;
  opacity: 0;
  transition: opacity .2s;
}
.drawer-backdrop.is-open { display: block; opacity: 1; }

/* ============================================================
   Responsive: Tablet
   タブレット（1024px）ではラベルを保持し、900px未満でアイコンのみにする
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 72px; }
  .sidebar__title, .sidebar__section, .sidebar__user > div, .badge-count,
  .sidebar__link > span:not(.material-symbols-outlined) {
    display: none;
  }
  .sidebar__brand { justify-content: center; padding: 16px 0; }
  .sidebar__user { justify-content: center; padding: 14px 0; }
  .sidebar__link {
    justify-content: center;
    padding: 10px 0;
    margin: 4px 10px;
  }
  .sidebar__link.is-active::before { display: none; }
  .sidebar__nav { padding: 8px 0; }

  .content { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .content > div[style*="grid-template-columns: 1.5fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   Responsive: Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .topbar { display: none; }
  .mobile-header { display: flex; }
  /* ★ 帯ごと隠すと、右上のボタン（スタッフを追加・新規追加・保存など）がスマホで押せなかった
       （2026-10-05 のご指示）。見出しは上の mobile-header に出ているので、**ボタンの列だけ**残す。
       ボタンが1つも無い画面は、これまでどおり帯ごと出さない。 */
  .topbar:has(> .topbar__actions > *) {
    display: flex; position: static; height: auto;
    padding: 10px 16px; gap: 0;
  }
  .topbar > :not(.topbar__actions) { display: none; }
  .topbar .topbar__actions { flex: 1; flex-shrink: 1; flex-wrap: wrap; justify-content: flex-start; min-width: 0; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 85vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s ease;
    height: 100vh;
    border-right: 0;
    box-shadow: 4px 0 24px rgba(15,23,42,.12);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__title, .sidebar__section, .sidebar__user > div, .badge-count,
  .sidebar__link > span:not(.material-symbols-outlined) { display: inline-block; }
  .sidebar__title { display: block; }
  .sidebar__brand { justify-content: flex-start; padding: 18px 20px; }
  .sidebar__user { justify-content: flex-start; padding: 14px 16px; }
  .sidebar__link { justify-content: flex-start; padding: 11px 14px; margin: 0 0 2px; }
  .sidebar__link.is-active::before { display: block; }
  .sidebar__nav { padding: 12px 10px; }

  .content { padding: 16px 14px 60px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 16px; gap: 14px; }
  .stat__icon { width: 48px; height: 48px; }
  .stat__icon .material-symbols-outlined { font-size: 26px; }
  .stat__num { font-size: 28px; }
  .stat__label { font-size: 13.5px; }
  .card { padding: 18px; border-radius: 12px; }
  .card__title { font-size: 17px; }
  .list-item__meta { min-width: 0; flex-wrap: wrap; }

  .content > div[style*="grid-template-columns: 1.5fr"],
  .content > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Form grid (詳細編集) */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > .form-side { position: static; }

  /* Data table: 横スクロール */
  .data-table-wrap { overflow-x: auto; }
  .data-table { min-width: 720px; }

  /* Filter bar */
  .filter-bar { padding: 14px; }
  .search { min-width: 0; width: 100%; }
}

/* ============================================================
   Desktop: サイドバー折りたたみ（topbar ハンバーガー）
   ============================================================ */
.topbar__menu-toggle {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--c-ink-700);
  flex-shrink: 0;
  margin-left: -8px;
  transition: background .15s, color .15s;
}
.topbar__menu-toggle:hover { background: var(--c-line-soft); color: var(--c-ink-900); }
.topbar__menu-toggle .material-symbols-outlined { font-size: 28px; }

/* ★ 901px から効かせる（9/3打ち合わせ No.20・2026-09-10）。
     それまで 1025px 以上でしか効かず、**タブレットではハンバーガーを押しても
     左メニューが畳めなかった**（しるしは付くのに幅が 300px のまま）。
     計画表のように横幅がほしい画面ほどタブレットで使うので、いちばん効く。
   ★ 900px 以下はアイコンだけの細い形（72px）に自動で切り替わり、
     ハンバーガー自体を出していないので、ここには入れない。 */
@media (min-width: 901px) {
  .app { transition: grid-template-columns .22s ease; }

  html.sidebar-collapsed { --sidebar-w: 76px; }
  html.sidebar-collapsed .sidebar__title,
  html.sidebar-collapsed .sidebar__label,
  html.sidebar-collapsed .sidebar__user > div:nth-child(2) { display: none; }

  html.sidebar-collapsed .sidebar__brand { justify-content: center; padding: 18px 0; }

  html.sidebar-collapsed .sidebar__nav { padding: 12px 0; }
  html.sidebar-collapsed .sidebar__section {
    font-size: 0; padding: 0; height: 0;
    margin: 12px 18px;
    border-top: 1px solid var(--c-line);
  }
  html.sidebar-collapsed .sidebar__section:first-child { display: none; }

  html.sidebar-collapsed .sidebar__link {
    justify-content: center;
    gap: 0;
    padding: 12px 0;
    margin: 3px 12px;
  }
  html.sidebar-collapsed .sidebar__link.is-active::before { display: none; }
  html.sidebar-collapsed .sidebar__link .badge-count {
    position: absolute; top: 3px; right: 6px; margin: 0;
    font-size: 12px; padding: 1px 5px; min-width: 16px;
  }

  html.sidebar-collapsed .sidebar__user {
    flex-direction: column; justify-content: center;
    gap: 10px; padding: 14px 0;
  }
}

/* アイコンのみ表示／ドロワーのためトグル不要 */
@media (max-width: 900px) {
  .topbar__menu-toggle { display: none; }
}

/* アイコンのみ表示時のツールチップ（トースター風スライドイン） */
.sidebar-tip {
  position: fixed; z-index: 200;
  transform: translate(-8px, -50%);
  background: var(--c-ink-900); color: #fff;
  font-size: 14.5px; font-weight: 600;
  line-height: 1.4;
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: var(--sh-2);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.sidebar-tip::before {
  content: ""; position: absolute;
  left: -4px; top: 50%;
  width: 8px; height: 8px;
  background: var(--c-ink-900);
  transform: translateY(-50%) rotate(45deg);
}
.sidebar-tip.is-show { opacity: 1; transform: translate(0, -50%); }
