/* ENTツールのホーム。色・文字・角の丸み・ボタンは、ホームページ作成ツールの app/style.css に合わせる。
   スマホ（幅390）が先。HTML に style 属性を書かない（CSP の style-src 'self'）。 */
:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #1d2422;
  --mut: #5d6662;
  --line: #d9d6cd;
  --brand: #1f3a34;
  --brand-ink: #ffffff;
  --brand-soft: #e8efe9;
  --accent: #c8553d;
  --ok: #2e7d4f;
  --warn: #9a6a00;
  --bad: #b3261e;
  --radius: 14px;
  --tabs: 64px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.7 'Hiragino Sans',
    'Hiragino Kaku Gothic ProN',
    'Noto Sans JP',
    system-ui,
    sans-serif;
  padding-bottom: calc(var(--tabs) + 24px + env(safe-area-inset-bottom));
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
a {
  color: var(--brand);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--brand);
  color: var(--brand-ink);
  min-height: 56px;
}
.top__brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.top__org {
  margin-left: auto;
  font-size: 13px;
  opacity: 0.85;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.top__logout {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  min-height: 36px;
  flex: none;
}
/* とても狭い画面（320px）でも、名前とログアウトを1段目に並べる */
@media (max-width: 350px) {
  .top {
    padding: 10px 12px;
    column-gap: 8px;
  }
  .top__logout {
    padding: 4px 10px;
  }
}
/* 名前（ENT technology TOOL）が長いので、狭い画面では会社名を2行目に出す */
@media (max-width: 520px) {
  .top {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  .top__org {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    max-width: none;
  }
  .top__org:empty {
    display: none;
  }
  .top__logout {
    margin-left: auto;
  }
}
.backbar {
  background: var(--brand-soft);
  border-bottom: 1px solid var(--line);
}
.backbar a {
  display: flex;
  align-items: center;
  max-width: 880px;
  min-height: 44px;
  margin: 0 auto;
  padding: 0 16px;
  font-size: 14px;
  color: var(--brand);
  text-decoration: none;
}
.backbar a:hover {
  text-decoration: underline;
}
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}
main:focus {
  outline: none;
}
main.plain {
  max-width: 560px;
  padding-top: 40px;
}
h1 {
  font-size: 22px;
  line-height: 1.4;
  margin: 8px 0 12px;
}
h2 {
  font-size: 17px;
  line-height: 1.4;
  margin: 0;
}
h3 {
  font-size: 15px;
  line-height: 1.4;
  margin: 16px 0 6px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 24px 0 10px;
}
.section-head h2 {
  font-size: 18px;
}
.lead {
  color: var(--mut);
  margin: 0 0 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
}
.card > :first-child {
  margin-top: 0;
}
.card > :last-child {
  margin-bottom: 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--card);
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn--main {
  background: var(--brand);
  color: var(--brand-ink);
}
.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--quiet {
  border-color: var(--line);
  color: var(--ink);
}
.btn--danger {
  border-color: var(--bad);
  color: var(--bad);
}
.btn--wide {
  width: 100%;
}
.btn--small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.row--end {
  justify-content: flex-end;
}
.gap {
  margin-top: 14px;
}
.chip {
  display: inline-block;
  font-size: 12px;
  line-height: 1.6;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}
.chip--ok {
  color: var(--ok);
}
.chip--warn {
  background: #f2ece0;
  color: var(--warn);
}
.chip--mute {
  background: #eeece6;
  color: var(--mut);
}
.chip--bad {
  background: #fbefed;
  color: var(--bad);
}
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
}
.note {
  font-size: 13px;
  color: var(--mut);
}
.note--ok {
  color: var(--ok);
}
.note--bad {
  color: var(--bad);
  font-weight: 700;
}
.loading {
  color: var(--mut);
}

/* ---------- ツールのカード ---------- */
.tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.tool {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.tool__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.tool__desc {
  margin: 0;
  font-size: 14px;
  color: var(--mut);
}
.tool__role {
  font-size: 13px;
  color: var(--mut);
  margin: 0;
}
.tool .btn {
  margin-top: auto;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.metrics div {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.metrics dt {
  font-size: 12px;
  color: var(--mut);
}
.metrics dd {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  min-height: 28px;
}
.state__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
}
.state--active .state__dot {
  background: var(--ok);
}
.state--setup .state__dot {
  background: var(--warn);
}
.state--down .state__dot {
  background: var(--bad);
}
.state--down {
  color: var(--bad);
}
.tool--other {
  background: transparent;
  border-style: dashed;
}

/* ---------- お知らせ ---------- */
.notices {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.notice:first-child {
  border-top: 0;
  padding-top: 0;
}
.notice__body {
  flex: 1;
  min-width: 0;
}
.notice__title {
  margin: 4px 0 2px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.notice.is-unread .notice__title::before {
  content: '●';
  color: var(--accent);
  margin-right: 6px;
  font-size: 11px;
}
.notice .btn {
  flex: none;
}

/* ---------- メンバー ---------- */
.member {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.member:first-child {
  border-top: 0;
  padding-top: 0;
}
.member__body {
  flex: 1;
  min-width: 0;
}
.member__name {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.member__mail {
  font-size: 13px;
  color: var(--mut);
  overflow-wrap: anywhere;
}
.member__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* ---------- 入力 ---------- */
.form label,
.field > label {
  display: block;
  font-weight: 700;
  margin: 14px 0 6px;
}
.form label:first-child {
  margin-top: 0;
}
.form input,
.form select,
.field input {
  display: block;
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-height: 48px;
}
.form .hint {
  font-size: 13px;
  color: var(--mut);
  margin: 4px 0 0;
}
.form fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 14px 0 0;
  padding: 4px 14px 14px;
}
.form legend {
  font-weight: 700;
  padding: 0 6px;
}
.form .btn {
  margin-top: 16px;
}
.inline-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.inline-form input {
  flex: 1;
  min-width: 0;
}
.inline-form .btn {
  margin-top: 0;
  flex: none;
}

/* ---------- ヘルプ ---------- */
.faq details {
  border-top: 1px solid var(--line);
  padding: 4px 0;
}
.faq h2 + details {
  border-top: 0;
}
.faq h2 {
  margin-bottom: 4px;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '＋';
  color: var(--mut);
}
.faq details[open] summary::after {
  content: '－';
}
.faq p,
.faq ul {
  margin: 0 0 10px;
}
.faq ul {
  padding-left: 20px;
}

/* ---------- 下のタブ ---------- */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs[hidden] {
  display: none;
}
.tabs a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tabs);
  font-size: 11px;
  font-weight: 700;
  color: var(--mut);
  text-decoration: none;
  white-space: nowrap;
}
.tabs svg {
  width: 24px;
  height: 24px;
}
.tabs a[aria-current='page'] {
  color: var(--brand);
}
.tabs a[aria-current='page']::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--brand);
}
.tabs .badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
}

/* ---------- 下から出る画面・お知らせの帯 ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet__in {
  background: var(--card);
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow: auto;
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.is-on {
  opacity: 1;
}
.results {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 14px;
}

/* ---------- 段階4: 申込・ご利用状況・請求・代理店・規約 ---------- */
.form label.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  margin: 18px 0 0;
}
.form .check input {
  display: inline-block;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  flex: none;
  accent-color: var(--brand);
}
.card--note {
  border-color: var(--accent);
  background: #fff8f5;
}
.card--note p {
  margin: 0 0 8px;
}
.facts {
  margin: 0;
}
.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.facts div:first-child {
  border-top: 0;
}
.facts dt {
  color: var(--mut);
  font-size: 14px;
  flex: none;
  white-space: nowrap;
}
.facts dd {
  margin: 0;
  min-width: 0;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}
.plan__name {
  font-size: 20px;
  font-weight: 700;
  margin: 8px 0 2px;
}
.metrics small {
  font-size: 13px;
  font-weight: 400;
  color: var(--mut);
}
.invoices {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.invoice-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.invoice-item:first-child {
  border-top: 0;
}
.invoice-item__body {
  flex: 1;
  min-width: 0;
}
.invoice-item__title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-weight: 700;
}
.invoice-item__total {
  font-variant-numeric: tabular-nums;
}
.invoice-item .member__chips {
  align-items: center;
}
.partner h3 {
  margin-top: 18px;
}

/* ---------- 段階3: 動画 ---------- */
.form input[type='file'] {
  padding: 10px 12px;
  background: var(--bg);
}
.progress {
  display: block;
  width: 100%;
  height: 14px;
  margin: 16px 0 6px;
  accent-color: var(--brand);
}
.progress__text {
  margin: 0 0 16px;
  font-weight: 700;
}
.facts dd.code,
.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.code-box {
  display: block;
  width: 100%;
  min-height: 96px;
  margin: 8px 0 0;
  padding: 10px 12px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  resize: vertical;
  overflow-wrap: anywhere;
}
.form h3 {
  margin-top: 0;
}
.partner .form {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 24px 0 8px;
  font-size: 13px;
}
.legal h1 {
  font-size: 22px;
}
.legal h2 {
  font-size: 18px;
  margin: 24px 0 8px;
}
.legal h3 {
  margin: 18px 0 6px;
}
.legal p,
.legal li {
  overflow-wrap: anywhere;
}
.legal ul,
.legal ol {
  padding-left: 22px;
}
.table {
  overflow-x: auto;
  margin: 12px 0;
}
.table table,
.invoice__sum {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.table th,
.table td,
.invoice__sum th,
.invoice__sum td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.table th {
  background: var(--bg);
}
main.plain--wide {
  max-width: 760px;
  padding-top: 16px;
}
.invoice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-top: 12px;
}
.invoice__title {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.3em;
  margin: 0 0 12px;
}
.invoice__stamp {
  text-align: center;
  font-weight: 700;
  border: 2px solid currentColor;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 0 auto 12px;
  max-width: 320px;
}
.invoice__stamp--paid {
  color: var(--ok);
}
.invoice__stamp--void {
  color: var(--bad);
}
.invoice__meta {
  margin: 0 0 12px;
  font-size: 14px;
}
.invoice__meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.invoice__meta dt {
  color: var(--mut);
}
.invoice__meta dd {
  margin: 0;
}
.invoice__parties {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.invoice__to {
  font-size: 18px;
  margin: 0;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 4px;
  overflow-wrap: anywhere;
}
.invoice__from p {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.invoice__total {
  font-size: 18px;
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
}
.invoice__total b {
  font-size: 22px;
  margin-left: 8px;
}
.invoice .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.invoice__lines th:nth-child(2) {
  white-space: nowrap;
}
.invoice__sum {
  margin: 0 0 12px auto;
  max-width: 360px;
}
.invoice__sum th {
  font-weight: 400;
  color: var(--mut);
}
.invoice__pay h2 {
  font-size: 15px;
  margin: 16px 0 4px;
}
.invoice__pay p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.blank {
  color: var(--bad);
  font-weight: 700;
}
body.print-page {
  padding-bottom: 24px;
}

@media print {
  .no-print,
  .tabs,
  .toast {
    display: none !important;
  }
  body,
  body.print-page {
    background: #fff;
    padding: 0;
  }
  main.plain,
  main.plain--wide {
    max-width: none;
    padding: 0;
  }
  .invoice {
    border: 0;
    padding: 0;
  }
  .invoice__parties {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  .tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .invoice {
    padding: 32px;
  }
  .invoice__parties {
    grid-template-columns: 1fr 1fr;
  }
  .sheet {
    align-items: center;
  }
  .sheet__in {
    border-radius: 18px;
  }
  .tabs {
    max-width: 640px;
    margin: 0 auto 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding-bottom: 0;
    overflow: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}
