/* BEPPANクラウド 入口の見た目。値は tokens.css を使い、ここではブランドと画面の組み立てだけを決める。 */

/* 入口の組み立て: 上に帯とタブ、中央に利用状況とサービス一覧、下にやることを並べる。 */
:root {
  --brand-50: #EEF4FC;
  --brand-100: #DCE8F8;
  --brand-200: #BCD3F2;
  --brand-300: #93B7E9;
  --brand-400: #6396DD;
  --brand-500: #3F7BD0;
  --brand-600: #2C68BF;
  --brand-700: #2356A2;
  --brand-800: #1C4583;
  --brand-900: #163565;
  --yellow-100: #FFF6D6;
  --yellow-400: #F7C948;
  --yellow-text: #7A5600;
  --font-sans: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", sans-serif;
  --bp-accent: var(--brand-600);
  --btn-line: var(--brand-300);
  --btn-text: var(--brand-600);
  --btn-soft: var(--brand-50);
  --color-bg-canvas: #F1F5FB;
  --color-status-success-text: var(--brand-800);
  --color-status-success-subtle: var(--brand-100);
  --color-status-info-text: var(--brand-700);
  --color-status-info-subtle: var(--brand-50);
  --color-status-warning-text: var(--yellow-text);
  --color-status-warning-subtle: var(--yellow-100);
  --color-status-danger-text: var(--yellow-text);
  --color-status-danger-subtle: var(--yellow-100);
  --ill-line: #24457F;
  --ill-blue: #9DBBEE;
  --ill-yellow: #F7C948;
  --ill-soft: #E6EFFB;
  --ill-paper: #FFFFFF;
  /* 起動映像だけの色。画面の中では使わない。 */
  --ink: linear-gradient(180deg, #212426, #181A1D);
  --mark: #AF1918;
}

/* サービスごとのメインカラー。--svc-on はボタンの文字、--svc-text は白地に置く文字。 */
[data-svc="office"] { --svc: #2F6FDE; --svc-on: #FFFFFF; --svc-text: #2458B8; --svc-soft: #E6EFFD; }
[data-svc="hr"] { --svc: #F5C02E; --svc-on: #3D2C00; --svc-text: #7A5600; --svc-soft: #FFF6D6; }
[data-svc="invoice"] { --svc: #4CC3EE; --svc-on: #07364D; --svc-text: #0B7199; --svc-soft: #E3F6FD; }
[data-svc="labor"] { --svc: #18804A; --svc-on: #FFFFFF; --svc-text: #146B3E; --svc-soft: #E4F5EB; }
[data-svc="partner"] { --svc: #B9A8F2; --svc-on: #2D1F66; --svc-text: #6048BD; --svc-soft: #F1EDFD; }
[data-svc="accounting"] { --svc: #1E3A78; --svc-on: #FFFFFF; --svc-text: #1E3A78; --svc-soft: #E7ECF6; }
[data-svc] {
  --color-action-primary: var(--svc);
  --color-action-primary-hover: var(--svc);
  --color-action-primary-text: var(--svc-on);
  --bp-accent: var(--svc-text);
  --btn-line: var(--svc);
  --btn-text: var(--svc-text);
  --btn-soft: var(--svc-soft);
  --ill-blue: var(--svc);
  --ill-soft: var(--svc-soft);
}
[data-svc] .btn.primary:hover { filter: brightness(.95); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--color-bg-canvas);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-x: clip;
}
[hidden] { display: none !important; }
a { color: var(--color-text-link); }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.skip { position: absolute; left: -999px; z-index: var(--z-skip-link); }
.skip:focus { left: var(--space-2); top: var(--space-2); background: var(--color-bg-surface); padding: var(--space-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* 起動映像。#app ではなく別の層で動かし、終わったら要素ごと消す。 */
#intro {
  position: fixed;
  inset: 0;
  z-index: var(--z-tooltip);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
  color: var(--mark);
  cursor: pointer;
  animation: intro-out 500ms ease 3700ms forwards;
}
#intro.leaving { animation: intro-out 200ms ease forwards; }
#intro .mark { position: relative; width: min(72vw, 760px); aspect-ratio: 972 / 335; }
#intro .half { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; }
#intro .half.l { left: 0; }
#intro .half.r { right: 0; }
#intro .slide { position: absolute; top: 0; width: 200%; animation: slide-out 1500ms cubic-bezier(.22, .8, .24, 1) 300ms both; }
#intro .half.l .slide { left: 0; --from: 50%; }
#intro .half.r .slide { right: 0; --from: -50%; }
#intro .wordmark { display: block; width: 100%; height: auto; }
@keyframes slide-out { from { transform: translateX(var(--from)); } to { transform: none; } }
@keyframes intro-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  #intro { animation: intro-out 300ms ease 600ms forwards; }
  #intro .slide { animation: none; }
}

/* ログイン。起動映像と同じ黒から続く夜の場面。 */
.auth {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background: radial-gradient(80% 50% at 50% 30%, rgba(175, 25, 24, .22), transparent 70%), linear-gradient(180deg, #0F1114, #181A1D 55%, #262C38);
  color: #FFFFFF;
}
.auth-city { position: fixed; inset: auto 0 0; height: max(36vh, 220px); pointer-events: none; }
.auth-city svg { display: block; width: 100%; height: 100%; }
.auth-city .w { opacity: var(--o); animation: auth-lit 700ms ease var(--d) both; }
.auth-city .w.blink { animation: auth-lit 700ms ease var(--d) both, auth-blink 5s ease-in-out calc(var(--d) + 2s) infinite; }
.auth-in {
  position: relative;
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-8);
  padding: var(--space-8) max(16px, env(safe-area-inset-left, 0px));
}
.auth-in > .logo { animation: auth-logo 800ms cubic-bezier(.22, .8, .24, 1) both; }
.auth-in > .logo svg { height: clamp(120px, 22vh, 176px); }
.auth-card {
  position: relative;
  width: min(calc(100vw - 32px), var(--auth-card-width));
  display: grid;
  gap: var(--space-4);
  padding: var(--space-6);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-sm);
  background: rgba(18, 20, 24, .78);
  backdrop-filter: blur(10px);
  animation: auth-rise 500ms ease 300ms both;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  --c: linear-gradient(#D8342F, #D8342F);
  background: var(--c) 0 0 / 18px 2px, var(--c) 0 0 / 2px 18px, var(--c) 100% 0 / 18px 2px, var(--c) 100% 0 / 2px 18px,
    var(--c) 0 100% / 18px 2px, var(--c) 0 100% / 2px 18px, var(--c) 100% 100% / 18px 2px, var(--c) 100% 100% / 2px 18px;
  background-repeat: no-repeat;
}
.auth-title { font-size: var(--text-md); font-weight: var(--weight-semibold); text-align: center; }
.auth .sample { padding: 0; background: none; color: #F5C02E; font-size: var(--text-xs); text-align: center; }
.auth .form-error { color: #FF9C94; text-align: center; }
.auth .form-error:empty, .auth .meta-line:empty { display: none; }
.auth .meta-line { color: rgba(255, 255, 255, .72); text-align: center; }
.auth .btn { border-color: rgba(255, 255, 255, .32); background: transparent; color: #FFFFFF; }
.auth .btn:hover { background: rgba(255, 255, 255, .1); }
.auth .btn.primary { display: flex; align-items: center; justify-content: center; gap: var(--space-3); border-color: #FFFFFF; background: #FFFFFF; color: #181A1D; font-weight: var(--weight-semibold); }
.auth .btn.primary:hover { background: #E3E6EB; }
.auth .input { border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .06); color: #FFFFFF; }
.auth .input::placeholder { color: rgba(255, 255, 255, .55); }
.auth :focus-visible { box-shadow: 0 0 0 2px #181A1D, 0 0 0 4px #FFFFFF; }
.auth .auth-mail { margin: 0; padding: 0; border: 0; gap: var(--space-3); }
.auth .auth-mail label { display: flex; align-items: center; gap: var(--space-3); color: rgba(255, 255, 255, .72); font-size: var(--text-xs); }
.auth .auth-mail label::before, .auth .auth-mail label::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .16); }
html.intro-on .auth-in > .logo, html.intro-on .auth-card, html.intro-on .auth-city .w { opacity: 0; animation: none; }
@keyframes auth-logo { from { opacity: 0; transform: scale(1.08); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes auth-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes auth-lit { 0% { opacity: 0; } 40% { opacity: 1; } 55% { opacity: .2; } 100% { opacity: var(--o); } }
@keyframes auth-blink { 0%, 86%, 100% { opacity: var(--o); } 92% { opacity: .1; } }
@media (prefers-reduced-motion: reduce) {
  .auth-in > .logo, .auth-card, .auth-city .w, .auth-city .w.blink { animation: none; }
}

/* 上の帯 */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: var(--z-header);
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border-subtle);
}
.top-in {
  max-width: var(--content-max-width);
  margin: 0 auto;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: 0 max(16px, env(safe-area-inset-left, 0px));
}
.brand { display: block; color: inherit; text-decoration: none; flex: none; }
.logo { display: inline-block; line-height: 0; }
.logo svg { display: block; height: 44px; width: auto; }
.tabbar { background: var(--color-bg-surface); border-bottom: 1px solid var(--color-border-subtle); }
.nav {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  gap: var(--space-2);
  padding: 0 max(16px, env(safe-area-inset-left, 0px));
  overflow-x: auto;
  scrollbar-width: none;
}
.nav a {
  padding: var(--space-3) var(--space-4);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--color-text-primary); }
.nav a[aria-current="page"] { border-color: var(--bp-accent); color: var(--brand-700); }
.top-actions { display: flex; align-items: center; gap: var(--space-2); flex: none; position: relative; }

/* 部品 */
.btn {
  min-height: var(--control-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  border: 1px solid var(--btn-line);
  border-radius: var(--radius-full);
  background: var(--color-bg-surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--btn-text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--btn-soft); }
.btn.primary { background: var(--color-action-primary); border-color: var(--color-action-primary); color: var(--color-action-primary-text); }
.btn.primary:hover { background: var(--color-action-primary-hover); }
.btn.block { width: 100%; min-height: var(--control-lg); }
.btn[disabled] { opacity: .6; cursor: default; }
.field { display: grid; gap: var(--space-1); }
.field label { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.input, .select {
  width: 100%;
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
}
.form-error { color: var(--color-status-danger-text); font-size: var(--text-sm); }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.8;
  white-space: nowrap;
}
.pill.active { background: var(--color-status-success-subtle); color: var(--color-status-success-text); }
.pill.linked { background: var(--color-status-info-subtle); color: var(--color-status-info-text); }
.pill.preparing, .pill.off { background: var(--color-status-neutral-subtle); color: var(--color-status-neutral-text); }
.pill.warn { background: var(--color-status-warning-subtle); color: var(--color-status-warning-text); }
.pill.danger { background: var(--yellow-400); color: #3D2C00; }

/* 画面 */
.page {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-6) var(--space-12);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.page-head h1 { font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.sample {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--yellow-100);
  color: var(--yellow-text);
  font-size: var(--text-sm);
}
.section { display: grid; gap: var(--space-3); }
.section > h2 { font-size: var(--text-md); font-weight: var(--weight-semibold); }

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-10);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-bg-surface);
}
.summary h1 { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.summary .btn { margin-left: auto; }
.stats { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-8); }
.stat {
  display: grid;
  gap: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  line-height: 1.3;
}
button.stat { cursor: pointer; border-radius: var(--radius-sm); }
button.stat:hover b { color: var(--bp-accent); }
.stat span { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.stat b { font-size: var(--text-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.stat small { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-tertiary); }

.section.lead > h2 { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.section > h2:focus { box-shadow: none; }
.products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.product {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-bg-surface);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
@media (hover: hover) {
  .product:has(.go):hover { transform: translateY(-2px); border-color: var(--bp-accent); box-shadow: var(--shadow-md); }
}
.product .go { min-width: 112px; }
.product .go::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.product .art { display: grid; place-items: center; aspect-ratio: 1; padding: var(--space-2); border-radius: var(--radius-lg); background: #181A1D; }
.product .art .logo { display: block; width: 100%; }
.product .art .logo svg { width: 100%; height: auto; }
.product .body { display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-2); align-self: stretch; min-width: 0; }
.product h3 { font-size: var(--text-md); font-weight: var(--weight-bold); line-height: 1.4; }
.product p { font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.5; text-wrap: pretty; }
.product .foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: var(--control-md); }
.product .count { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.a-i { fill: var(--ill-blue); }
.a-g { fill: var(--ill-yellow); }
.a-s { fill: var(--ill-soft); }
.a-b { fill: var(--ill-paper); }
.a-p { fill: var(--ill-paper); stroke: var(--ill-line); stroke-width: 4; stroke-linejoin: round; }
.a-l { fill: none; stroke: var(--ill-line); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.a-l.thin { stroke-width: 3; }
.a-w { fill: none; stroke: var(--ill-line); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) {
  .product { transition: none; }
  .product:has(.go):hover { transform: none; }
}

/* サービスの管理画面 */
:root[data-svc] {
  --svc-line: color-mix(in srgb, var(--svc) 45%, #FFFFFF);
  --color-bg-canvas: var(--svc-soft);
  --color-text-secondary: var(--gray-700);
  --color-text-tertiary: var(--gray-600);
}
:root[data-svc] .top { background: var(--svc); border-bottom: 0; }
:root[data-svc] .top .logo { color: var(--svc-on); }
:root[data-svc] .top .btn { background: #FFFFFF; border-color: #FFFFFF; color: var(--svc-text); }
:root[data-svc] .top .btn:hover { background: var(--svc-soft); }
:root[data-svc] .top-in { max-width: none; }
.grid-gap { display: grid; gap: var(--space-4); }
.svc-body { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - var(--header-height)); }
.svc-menu { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-3); background: var(--color-bg-surface); border-right: 1px solid var(--svc-line); }
.svc-menu a { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); color: var(--color-text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap; }
.svc-menu a:hover { background: var(--svc-soft); }
.svc-menu a[aria-current="page"] { background: var(--svc); color: var(--svc-on); font-weight: var(--weight-semibold); }
.svc-menu a.svc-head { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) var(--space-3); margin-bottom: var(--space-2); border-bottom: 1px solid var(--svc-line); border-radius: 0; color: var(--svc-text); font-size: var(--text-base); }
.svc-menu a.svc-head:hover { background: none; }
.svc-art { width: 40px; flex: none; }
.svc-art svg { display: block; width: 100%; height: auto; }
.svc-body .page { width: 100%; margin: 0; align-content: start; }
.svc-body .page-head h1 { color: var(--svc-text); }
.svc-body .section > h2 { color: var(--svc-text); }
.svc-body .summary { border: 1px solid var(--svc-line); border-top: 4px solid var(--svc); }
.svc-body .stat b { color: var(--svc-text); }
.svc-body .panel { border-color: var(--svc-line); }
.svc-body th { background: var(--svc-soft); color: var(--svc-text); font-weight: var(--weight-semibold); }
.svc-body th, .svc-body td, .svc-body .rows li { border-color: var(--svc-line); }
.svc-body .tabs { border-color: var(--svc-line); }
.svc-body .tabs a { color: var(--color-text-secondary); }
.svc-body .tabs a[aria-selected="true"] { color: var(--svc-text); font-weight: var(--weight-semibold); border-bottom-width: 3px; }
.svc-body .pill.preparing { background: var(--svc-soft); color: var(--svc-text); }
.svc-body tbody tr[data-id]:hover { background: var(--svc-soft); }
.svc-body .sample { background: #FFFFFF; border: 1px solid var(--svc-line); color: var(--color-text-secondary); }

/* BEPPAN請求書 */
.inv-table td:first-child { min-width: 180px; }
.inv-table .sub { display: none; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.month { display: flex; align-items: center; gap: var(--space-3); }
.month .btn { padding: 0 var(--space-3); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.drawer.wide { width: min(100%, var(--drawer-lg)); }
.note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.meta-line { font-size: var(--text-xs); color: var(--color-text-tertiary); overflow-wrap: anywhere; }
.tick { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; font-size: var(--text-sm); }
.facts dt { color: var(--color-text-tertiary); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.send-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-border-subtle); font-size: var(--text-sm); }
.send-list li { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border-subtle); }
.sheet-wrap { overflow-x: auto; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--gray-100); padding: var(--space-3); }
.sheet { min-width: 560px; display: grid; gap: var(--space-3); padding: var(--space-6); background: #FFFFFF; color: var(--gray-900); font-size: var(--text-xs); line-height: 1.6; }
.sheet h3 { text-align: center; font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: .1em; }
.sheet dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 0 var(--space-3); justify-content: end; }
.sheet dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sheet-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-6); }
.sheet-to { font-size: var(--text-md); font-weight: var(--weight-semibold); padding-bottom: var(--space-1); border-bottom: 1px solid var(--gray-800); margin-bottom: var(--space-3); }
.sheet-label { font-weight: var(--weight-semibold); }
.sheet-total { font-size: var(--text-2xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.sheet table { font-size: var(--text-xs); }
.sheet th, .sheet td { padding: var(--space-1) var(--space-2); border: 1px solid var(--gray-300); }
.sheet th { background: var(--gray-100); color: var(--gray-800); }
.sheet-sum { width: 240px; margin-left: auto !important; justify-content: stretch !important; grid-template-columns: 1fr auto !important; }
.sheet-bank { white-space: pre-line; }

.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.panel { border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); background: var(--color-bg-surface); overflow: hidden; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: var(--space-3); min-height: var(--row-comfortable); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--color-border-subtle); }
.rows li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .meta { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.rows .due { font-size: var(--text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows a { color: inherit; text-decoration: none; }
.check { width: 18px; height: 18px; flex: none; border-radius: var(--radius-full); border: 1px solid var(--color-border-control); }
.check.done { background: var(--color-action-primary); border-color: var(--color-action-primary); }

.tools { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.tools .input { flex: 1 1 220px; width: auto; }
.tools .select { flex: 0 0 auto; width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-weight: var(--weight-medium); color: var(--color-text-tertiary); background: var(--color-bg-subtle); white-space: nowrap; }
th, td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border-subtle); }
thead th { border-top: 0; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover { background: var(--color-bg-hover); }
.state { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-12) var(--space-4); color: var(--color-text-secondary); text-align: center; }
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--color-border-subtle); overflow-x: auto; }
.tabs a { padding: var(--space-2) var(--space-3); color: var(--color-text-secondary); font-size: var(--text-sm); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-selected="true"] { color: var(--color-text-primary); border-color: var(--bp-accent); font-weight: var(--weight-medium); }
.form { display: grid; gap: var(--space-4); max-width: var(--form-max-width); padding: var(--space-5); }

/* 右から出る入力欄とメニュー */
.backdrop { position: fixed; inset: 0; z-index: var(--z-drawer-backdrop); background: var(--color-overlay); }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-drawer);
  width: min(100%, var(--drawer-md));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--color-bg-surface);
  box-shadow: var(--shadow-xl);
}
.drawer header, .drawer footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-4) var(--space-5); }
.drawer header { border-bottom: 1px solid var(--color-border-subtle); }
.drawer footer { border-top: 1px solid var(--color-border-subtle); padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); }
.drawer h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.drawer .body { display: grid; grid-auto-rows: max-content; gap: var(--space-4); align-content: start; padding: var(--space-5); overflow-y: auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: var(--z-popover);
  min-width: 240px;
  padding: var(--space-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface-raised);
  box-shadow: var(--shadow-lg);
}
.menu a, .menu button, .menu span.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu span.item { cursor: default; color: var(--color-text-tertiary); }
.menu a:hover, .menu button:hover { background: var(--color-bg-hover); }
.menu .who { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); color: var(--color-text-tertiary); }

#toast { position: fixed; left: 50%; bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); z-index: var(--z-toast); translate: -50% 0; }
#toast div { padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); background: var(--color-bg-inverse); color: var(--color-text-inverse); font-size: var(--text-sm); }

@media (max-width: 1180px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .svc-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .svc-menu { flex-direction: row; align-items: center; overflow-x: auto; scrollbar-width: none; padding: var(--space-2) var(--space-3); border-right: 0; border-bottom: 1px solid var(--svc-line); }
  .svc-menu a.svc-head { padding: 0 var(--space-2) 0 0; margin: 0; border-bottom: 0; }
  .svc-menu a.svc-head b { display: none; }
  .svc-art { width: 32px; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .inv-table .wide-only { display: none; }
  .inv-table .sub { display: block; }
  .inv-table td:first-child { min-width: 0; }
  .products { grid-template-columns: 1fr; }
  .product { grid-template-columns: 80px minmax(0, 1fr); padding: var(--space-4); }
  .summary .btn { margin-left: 0; }
}
@media (max-width: 640px) {
  .two { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* 台帳と共通部品 */
.head-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.page-head { flex-wrap: wrap; gap: var(--space-3); }
.banner { margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-bg-surface); border: 1px solid var(--color-border-default, #D9E2EC); font-size: var(--text-sm); }
.banner.warn { background: #FFF8E1; border-color: #F5C02E; }
.pager { display: flex; justify-content: center; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.plain { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: var(--space-3); }
.input.area { height: auto; line-height: 1.6; padding-block: var(--space-2); resize: vertical; font: inherit; }
.form-grid { display: grid; gap: var(--space-4); }
.form-grid > .plain { gap: var(--space-4); }
.form-block { padding: var(--space-4); display: grid; gap: var(--space-3); }
.form-block h2 { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.panel > .form-block + .rows { border-top: 1px solid var(--color-border-default, #D9E2EC); }
.pane-head { display: flex; justify-content: flex-end; padding: var(--space-3); }
.sub { display: block; font-size: var(--text-xs, 12px); color: var(--color-text-secondary); }
.sub-head { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin: var(--space-2) 0 0; padding: 0; }
.line-table { min-width: 560px; }
.line-table th, .line-table td { padding: var(--space-1); }
.line-table .input, .line-table .select { width: 100%; min-width: 0; }
.line-table td:nth-child(1) { min-width: 180px; }
.line-table td:nth-child(3) { min-width: 96px; }
.line-table td:nth-child(4), .line-table td:nth-child(5) { width: 72px; }
.input.num { text-align: right; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.foot-left { display: flex; gap: var(--space-2); }
.btn.danger { background: #FDECEA; border-color: #E5857B; color: #A32317; }
.errors { margin: 0; padding-left: var(--space-5); color: #A32317; font-size: var(--text-sm); }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); max-height: 45vh; overflow: auto; }
.pick-list .tick { display: flex; gap: var(--space-2); align-items: center; }
.pick-list .grow { flex: 1; min-width: 0; }
.mail-body { margin: 0; padding: var(--space-3); background: var(--color-bg-subtle, #F4F7FA); border-radius: var(--radius-md); white-space: pre-wrap; font: inherit; font-size: var(--text-sm); }
.access-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: var(--space-2); align-items: center; }
.auth-mail { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border-default, #D9E2EC); display: grid; gap: var(--space-2); text-align: left; }
.auth-mail label { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.auth-row { display: flex; gap: var(--space-2); }
.auth-row .input { flex: 1; min-width: 0; }
.tools.wrap { flex-wrap: wrap; }
.tools .input.narrow { flex: 0 1 150px; width: auto; }
a.stat { color: inherit; text-decoration: none; }
a.stat:hover b { color: var(--svc-text, var(--color-text-primary)); text-decoration: underline; }
.stat em { display: block; font-style: normal; font-size: var(--text-xs, 12px); color: var(--color-text-secondary); }

/* カレンダー */
.cal-wrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr)); min-width: 700px; }
.cal-head { padding: var(--space-2); text-align: center; font-size: var(--text-xs, 12px); color: var(--color-text-secondary); border-bottom: 1px solid var(--color-border-default, #D9E2EC); }
.cal-day { min-height: 92px; padding: var(--space-1); border-right: 1px solid var(--color-border-default, #D9E2EC); border-bottom: 1px solid var(--color-border-default, #D9E2EC); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day b { font-size: var(--text-xs, 12px); font-weight: var(--weight-medium); color: var(--color-text-secondary); }
.cal-day.today b { color: var(--color-text-primary); font-weight: var(--weight-semibold); }
.cal-day.today { background: var(--color-bg-subtle, #F4F7FA); }
.cal-day.off { background: var(--color-bg-subtle, #F4F7FA); }
.cal-ev { display: block; padding: 1px 4px; border-radius: 4px; font-size: 11px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--svc-soft, #E8F1FB); color: var(--svc-text, #1E3A78); }
.cal-list { display: none; }
@media (max-width: 720px) {
  .cal-wrap { display: none; }
  .cal-list { display: block; }
  .tools .input.narrow { flex: 1 1 40%; }
}

.sheet-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.sheet-remarks { min-height: 64px; padding: var(--space-2); border: 1px solid var(--color-border-default, #D9E2EC); font-size: var(--text-xs, 12px); white-space: pre-wrap; }
.sheet-remarks span { display: block; color: var(--color-text-secondary); }

.table-wrap { position: relative; }

.pane-foot { display: flex; justify-content: center; padding: var(--space-3); border-top: 1px solid var(--color-border-default, #D9E2EC); }
