/* ─── リセット ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── 色 (山形伝統芸能振興) ─── */
:root {
  --paper: #fbf8f2;          /* 生成り: 背景 */
  --surface: #fff;           /* 入力欄・ボタンの地 */
  --ink: #2b2523;            /* 墨: 文字 */
  --ink-sub: #6e645d;        /* 鈍色: 補足の文字 */
  --ink-faint: #a59a91;
  --line: #e4dacd;           /* 罫線 */
  --line-strong: #c9b9a6;
  --disabled: #efe9e0;
  --accent: #8e2e34;         /* 臙脂: ヘッダー・主なボタン・リンク */
  --gold: #b0894a;           /* 金茶: 飾りの細い線 */
  --danger: #c4361b;         /* 朱: 打刻忘れ・エラー */
  --danger-bg: #fcefe9;
}

/* ─── 基本 ─── */
body {
  font-family: 'M PLUS 1', -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: var(--accent);
}

h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

/* 見出しの下の金茶の短い線 */
h1::after {
  content: '';
  display: block;
  width: 2rem;
  margin-top: 0.4rem;
  border-bottom: 2px solid var(--gold);
}

/* ─── ヘッダー ─── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  color: var(--paper);
  background: var(--accent);
  border-bottom: 3px solid var(--gold);
}

.app-name {
  font-weight: 600;
  letter-spacing: 0.15em;
}

.logout {
  font-size: 0.875rem;
  color: var(--paper);
}

/* ─── 本文 ─── */
.app-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.welcome {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.message {
  margin-bottom: 1rem;
}

.message.error {
  padding: 0.75rem 1rem;
  color: var(--danger);
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
}

.link {
  margin-top: 1.5rem;
}

/* ─── フォーム ─── */
.form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form label {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form input {
  font-size: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

/* ─── ボタン ─── */
.button {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 1rem;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.button.primary {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.menu {
  display: flex;
  flex-direction: column;
}

/* ─── メニュー (打刻) ─── */
.alert {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 4px;
}

.alert ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
  list-style: none;
}

.alert a {
  color: var(--danger);
}

.clock {
  text-align: center;
  margin-bottom: 1rem;
}

.clock-date {
  font-size: 1rem;
}

.clock-time {
  font-size: 3rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.today {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.today dd {
  font-variant-numeric: tabular-nums;
}

.stamp-buttons {
  display: flex;
  gap: 1rem;
}

.stamp-form {
  flex: 1;
}

.button.stamp {
  padding: 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.button:disabled {
  color: var(--ink-faint);
  background: var(--disabled);
  border-color: var(--line);
}

/* ─── 出勤の一覧 ─── */
.month-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.attendance {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.attendance th,
.attendance td {
  padding: 0.5rem 0.25rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.attendance th {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-sub);
}

.attendance tr.missing td {
  color: var(--danger);
}

.attendance tr.missing a {
  color: var(--danger);
  font-weight: 600;
}

.tag {
  margin-left: 0.25rem;
  font-size: 0.75rem;
  color: var(--ink-sub);
}

.form textarea {
  font-size: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: inherit;
}

/* ─── 宴会: 一覧 ─── */
h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
}

.month-nav.spaced {
  margin-top: 1.5rem;
}

.banquet-list {
  list-style: none;
  border-top: 1px solid var(--line);
}

.banquet-list li {
  border-bottom: 1px solid var(--line);
}

.banquet-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.5rem;
  padding: 0.75rem 0.25rem;
  color: inherit;
  text-decoration: none;
}

.banquet-venue {
  grid-column: 1;
  font-weight: 600;
}

.banquet-meta {
  grid-column: 1;
  font-size: 0.875rem;
  color: var(--ink-sub);
}

.status {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  font-size: 0.875rem;
  color: var(--ink-sub);
}

.status.draft {
  color: var(--danger);
}

/* ─── 宴会: 入力 ─── */
.form select {
  font-size: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.participant {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border: none;
  border-bottom: 1px solid var(--line);
}

.times {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.times input {
  flex: 1;
  min-width: 0;
}

.remove-row {
  align-self: flex-end;
  font-size: 0.875rem;
  color: var(--ink-sub);
  background: none;
  border: none;
  text-decoration: underline;
}

/* ─── 宴会: 確認 (お客様に見せる) ─── */
.receipt {
  margin-bottom: 1.5rem;
}

.receipt-date {
  font-size: 1.125rem;
}

.receipt-venue {
  font-size: 1.5rem;
  font-weight: 600;
}

.receipt-event {
  color: var(--ink-sub);
}

.receipt-table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.receipt-table th,
.receipt-table td {
  padding: 0.5rem 0.25rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.receipt-table thead th {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-sub);
}

.receipt-table .num {
  text-align: right;
  white-space: nowrap;
}

.receipt-table small {
  color: var(--ink-sub);
}

.receipt-table tfoot th {
  font-weight: 400;
}

.receipt-table tr.total th,
.receipt-table tr.total td {
  font-size: 1.5rem;
  font-weight: 600;
  border-bottom: 2px solid var(--ink);
}

.receipt-note {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-sub);
}

/* ─── 宴会: サイン (横向き) ─── */
.sign-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

.sign-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.5rem;
  gap: 0.5rem;
}

.sign-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

#sign-canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--ink);
  border-radius: 4px;
  touch-action: none;
}

.sign-buttons {
  display: flex;
  gap: 0.5rem;
}

.sign-buttons .button {
  margin-top: 0;
  padding: 0.75rem;
}

#sign-message:empty {
  display: none;
}

.rotate-notice {
  display: none;
}

@media (orientation: portrait) {
  .sign-area {
    display: none;
  }

  .rotate-notice {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    height: 100%;
    font-size: 1.25rem;
  }
}

[hidden] {
  display: none !important;
}

/* ─── 顔認証 (カメラ) ─── */
.login-or {
  margin: 1.5rem 0 0;
  text-align: center;
  color: var(--ink-sub);
  font-size: 0.875rem;
}

.face-note {
  color: var(--ink-sub);
  font-size: 0.875rem;
}

.face-guide {
  margin: 0.5rem 0 0.75rem;
}

.face-camera {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--ink);
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.face-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.face-frame {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 58%;
  aspect-ratio: 3 / 4;
  transform: translate(-50%, -50%);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
