:root {
  --bg: #f6f7f3;
  --panel: #ffffff;
  --panel-soft: #eef4ec;
  --panel-accent: #e8f2ff;
  --line: #d9e2d7;
  --text: #173123;
  --text-soft: #5a6f61;
  --brand: #275f43;
  --brand-strong: #18452f;
  --accent: #e9b949;
  --danger: #a82d34;
  --danger-soft: #fff1f2;
  --success: #17603b;
  --success-soft: #e9f7ef;
  --info-soft: #eef5ff;
  --shadow: 0 12px 32px rgba(23, 49, 35, 0.08);
  --radius: 20px;
  --radius-sm: 14px;
  --content-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #fff7ed 0%, #f8fafc 42%, #e2e8f0 100%);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.7;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  border-bottom: 1px solid rgba(39, 95, 67, 0.08);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.topbar__inner,
.footer__inner,
.page {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 16px;
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}

.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d5d41, #3f8e67);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
}

.brand__text small {
  display: block;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 400;
}

.brand--compact .brand__mark,
.brand--mobile .brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.nav-link.is-active {
  background: var(--panel-soft);
  color: var(--brand-strong);
}

.page {
  padding-top: 24px;
  padding-bottom: 40px;
}

.hero,
.panel,
.metric,
.list-item,
.card,
.empty,
.notice,
.legal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(233, 185, 73, 0.22), transparent 34%),
    radial-gradient(circle at top left, rgba(75, 149, 115, 0.18), transparent 30%),
    #ffffff;
}

.hero__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: #517362;
}

.hero__title {
  margin: 8px 0 0;
  font-size: 2rem;
  line-height: 1.25;
}

.hero__desc {
  margin: 12px 0 0;
  color: var(--text-soft);
}

.hero__actions,
.button-row,
.inline-actions,
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero__actions {
  margin-top: 18px;
}

.button,
.button--secondary,
.button--danger,
.button--ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
}

.button {
  background: var(--brand);
  color: #fff;
}

.button:hover {
  background: var(--brand-strong);
  text-decoration: none;
}

.button--secondary {
  background: #fff;
  color: var(--brand-strong);
  border-color: #b8ccbf;
}

.button--danger {
  background: #fff;
  color: var(--danger);
  border-color: #e2aeb2;
}

.button--ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--line);
}

.grid,
.card-grid,
.metric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.grid > *,
.card-grid > *,
.metric-grid > * {
  min-width: 0;
}

.metric-grid > * {
  flex: 1 1 220px;
}

.card-grid > * {
  flex: 1 1 280px;
}

.metric,
.panel,
.card,
.list-item,
.legal,
.empty,
.notice {
  padding: 18px;
}

.metric__label,
.field__label,
.section-title__eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #678170;
}

.metric__value {
  display: block;
  margin-top: 8px;
  font-size: 1.6rem;
  font-weight: 800;
}

.metric__sub {
  display: block;
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.section {
  margin-top: 20px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.section-copy,
.muted {
  color: var(--text-soft);
}

.stack > * + * {
  margin-top: 14px;
}

.field {
  margin-top: 12px;
}

.field:first-child {
  margin-top: 0;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.field__hint {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid #b9c8bc;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 10px;
  color: var(--text-soft);
}

.checkbox input {
  margin-top: 5px;
}

.badge,
.tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill {
  background: var(--panel-soft);
  color: var(--brand-strong);
}

.tag {
  background: var(--panel-accent);
  color: #1f4f7b;
}

.tag--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag--success {
  background: var(--success-soft);
  color: var(--success);
}

.notice {
  background: #fffdf4;
}

.notice--error {
  background: var(--danger-soft);
  border-color: #e6bcc0;
  color: #7d252b;
}

.notice--success {
  background: var(--success-soft);
  border-color: #b7dcc5;
  color: var(--success);
}

.notice--info {
  background: var(--info-soft);
  border-color: #c8d6ef;
  color: #21446d;
}

.notice__title {
  display: block;
}

.notice__list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.notice__list li + li {
  margin-top: 6px;
}

.list {
  display: block;
}

.list-item + .list-item {
  margin-top: 12px;
}

.list-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.list-item__title {
  margin: 0;
  font-size: 1.04rem;
}

.list-item__meta {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
}

.message--mine {
  background: #eef8f0;
  border-color: #c4ddcb;
}

.message__meta {
  font-size: 0.82rem;
  color: var(--text-soft);
}

.message__body {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.split__main {
  flex: 2 1 460px;
  min-width: 0;
}

.split__side {
  flex: 1 1 280px;
  min-width: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #e4ebe2;
  font-size: 0.92rem;
  vertical-align: top;
}

.table th {
  color: var(--text-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.empty {
  color: var(--text-soft);
}

.favorite-toggle {
  border: 1px solid #d2ddcf;
  background: #fff;
  color: #8a7430;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 1.1rem;
}

.footer {
  padding: 30px 0 50px;
  color: var(--text-soft);
}

.footer__inner {
  font-size: 0.92rem;
}

.footer__links {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.loading {
  padding: 40px 0;
  text-align: center;
  color: var(--text-soft);
}

.site-shell--auth {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(251, 191, 36, 0.28), transparent 34%),
    radial-gradient(circle at right 20%, rgba(15, 23, 42, 0.08), transparent 28%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.12), transparent 24%),
    linear-gradient(180deg, #fff7ed 0%, #f8fafc 42%, #e2e8f0 100%);
}

.auth-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 28px 16px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: center;
}

.auth-visual {
  color: #0f172a;
}

.auth-visual__eyebrow,
.auth-card__eyebrow,
.appbar__eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #b45309;
}

.auth-visual__title {
  margin: 12px 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-visual__desc {
  max-width: 28rem;
  margin: 14px 0 0;
  color: #475569;
}

.auth-shell__panel {
  width: 100%;
}

.brand--mobile {
  display: none;
  margin-bottom: 18px;
}

.auth-card {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
  padding: 22px;
}

.auth-card__header {
  margin-bottom: 18px;
}

.auth-card__title {
  margin: 10px 0 0;
  font-size: 2rem;
  line-height: 1.2;
}

.auth-card__desc {
  margin: 12px 0 0;
  color: #475569;
}

.auth-form-grid {
  display: grid;
  gap: 14px;
}

.auth-login-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  margin-bottom: 14px;
  border: 1px solid rgba(203, 213, 225, 0.84);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.72);
}

.auth-login-tab {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #64748b;
  font-weight: 800;
}

.auth-login-tab.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.auth-login-panel[hidden] {
  display: none;
}

.auth-login-footer {
  margin-top: 4px;
}

.auth-form-actions,
.form-actions-spaced {
  margin-top: 22px;
}

.panel--soft {
  background: rgba(248, 250, 252, 0.72);
  border-color: rgba(203, 213, 225, 0.84);
  box-shadow: none;
}

.site-shell--auth .notice {
  margin-bottom: 14px;
}

.site-shell--auth .button,
.site-shell--auth .button--secondary,
.site-shell--auth .button--danger,
.site-shell--auth .button--ghost {
  min-height: 46px;
}

.site-shell--app {
  min-height: 100vh;
  background: #ffffff;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.appbar__inner,
.page--app,
.footer-dock__inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.appbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
}

.appbar__group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.appbar__menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  text-decoration: none;
}

.appbar__menu {
  width: 40px;
  padding: 0;
  font-size: 1.1rem;
}

.appbar__title {
  min-width: 0;
}

.appbar__title strong {
  display: block;
  font-size: 1rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.app-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.36);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.app-drawer__sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: min(320px, 86vw);
  height: 100%;
  padding: 18px 16px 20px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  transform: translateX(-102%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.app-drawer__header .pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.app-drawer.is-open {
  pointer-events: auto;
}

.app-drawer.is-open .app-drawer__backdrop {
  opacity: 1;
}

.app-drawer.is-open .app-drawer__sheet {
  transform: translateX(0);
}

.app-drawer__header {
  display: grid;
  gap: 12px;
}

.app-drawer__nav {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  flex: 1 0 auto;
}

.app-drawer__link {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  color: #334155;
  font-weight: 600;
}

.app-drawer__link.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

.app-drawer__logout {
  width: 100%;
  margin-top: auto;
}

.page--app {
  padding-top: 18px;
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

.hero--app {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 36%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: #e2e8f0;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.site-shell--app .section {
  margin-top: 16px;
}

.site-shell--app .metric,
.site-shell--app .panel,
.site-shell--app .card,
.site-shell--app .list-item,
.site-shell--app .empty,
.site-shell--app .notice,
.site-shell--app .legal {
  border-radius: 22px;
  border-color: #e2e8f0;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
}

.footer-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: transparent;
}

.footer-dock__inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 8px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
}

.footer-dock__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
  color: #475569;
  font-size: 0.94rem;
  font-weight: 700;
}

.footer-dock__link.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

pre.code {
  margin: 0;
  padding: 16px;
  background: #f2f5f3;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

ul.clean,
ol.clean {
  margin: 10px 0 0;
  padding-left: 20px;
}

@media (max-width: 720px) {
  .hero__title {
    font-size: 1.6rem;
  }

  .topbar__inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .button,
  .button--secondary,
  .button--danger,
  .button--ghost {
    width: 100%;
  }

  .hero__actions .button,
  .hero__actions .button--secondary,
  .hero__actions .button--ghost,
  .hero__actions .button--danger,
  .button-row .button,
  .button-row .button--secondary,
  .button-row .button--ghost,
  .button-row .button--danger {
    width: auto;
  }

  .auth-card {
    padding: 22px 18px;
    border-radius: 28px;
  }

  .footer-dock__inner {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .auth-visual {
    display: none;
  }

  .brand--mobile {
    display: inline-flex;
  }

  .site-shell--auth {
    background:
      radial-gradient(circle at top, rgba(251, 191, 36, 0.18), transparent 28%),
      linear-gradient(180deg, #fff7ed 0%, #f8fafc 42%, #e2e8f0 100%);
  }
}
