:root {
  --ink: #1a1410;
  --paper: #f7f2eb;
  --accent: #8b4513;
  --border: #e8dfd0;
  --muted: #6b5e52;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  color: var(--accent);
}

.login-sub { color: var(--muted); margin: 0 0 1.5rem; }

.login-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.login-card input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.flash-error { background: #fde8e8; color: #9b1c1c; }
.flash-success { background: #e8f5e9; color: #1b5e20; }

.layout-with-sidebar {
  margin-left: 220px;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 220px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.sidebar-brand {
  padding: 0 1rem 1rem;
  font-weight: bold;
  color: var(--accent);
  font-size: 0.95rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.sidebar nav a {
  padding: 0.5rem 1rem;
  color: var(--ink);
  text-decoration: none;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: var(--paper);
  color: var(--accent);
}

.sidebar hr { border: none; border-top: 1px solid var(--border); margin: 0.5rem 0; }
.sidebar-footer { padding: 1rem; font-size: 0.9rem; }

.sidebar__brand { padding: 0 1rem 0.75rem; }
.sidebar__brand-link {
  color: var(--accent);
  text-decoration: none;
  display: block;
}
.sidebar__brand-main {
  display: block;
  font-weight: bold;
  font-size: 1rem;
}
.sidebar__brand-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--muted, #666);
}
.sidebar__user {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.sidebar__user-name { font-weight: 600; }
.sidebar__user-role { color: var(--muted, #666); margin-top: 0.2rem; }
.sidebar__nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 0.5rem;
}
.sidebar__section { margin-bottom: 0.35rem; }
.sidebar__section-title {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted, #666);
  text-transform: none;
}
.sidebar__link {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}
.sidebar__link:hover,
.sidebar__link.is-active {
  background: var(--paper);
  color: var(--accent);
}
.sidebar__footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.sidebar__logout { color: var(--ink); text-decoration: none; }
.sidebar__logout:hover { color: var(--accent); }

.content { padding: 1.5rem 2rem; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.dash-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  color: var(--ink);
  text-decoration: none;
}

.dash-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media print {
  .sidebar { display: none; }
  .layout-with-sidebar { margin-left: 0; }
  .no-print { display: none !important; }
}

/* --- 予約詳細・一覧共通 --- */
.page-header { margin-bottom: 1.25rem; }
.page-header h1 { margin: 0 0 0.35rem; font-size: 1.6rem; color: var(--accent); }
.page-header__meta { margin: 0; color: var(--muted); font-size: 0.95rem; }
.text-muted { color: var(--muted); }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.button {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

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

.button--primary:hover { opacity: 0.92; color: #fff; }
.button--danger {
  background: #9b1c1c;
  border-color: #9b1c1c;
  color: #fff;
}
.button--danger:hover { opacity: 0.92; color: #fff; }
.button--small { padding: 0.25rem 0.55rem; font-size: 0.8rem; }

.flash-success { background: #e8f5e9; color: #1b5e20; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.summary-card__label { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.25rem; }
.summary-card__value { font-size: 1.1rem; font-weight: 600; }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.panel__header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}

.panel__header h2 { margin: 0; font-size: 1rem; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th { width: 140px; background: #faf8f5; font-weight: 600; white-space: nowrap; }
.data-table thead th { background: var(--paper); width: auto; }
.data-table__total th,
.data-table__total td { border-top: 2px solid var(--border); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #eee;
}
.badge--confirmed { background: #e8f5e9; color: #1b5e20; }
.badge--tentative { background: #fff8e1; color: #8a6d00; }
.badge--cancelled,
.badge--no_show { background: #fde8e8; color: #9b1c1c; }
.badge--seated { background: #e3f2fd; color: #0d47a1; }
.badge--completed { background: #eceff1; color: #37474f; }
.badge--danger { background: #fde8e8; color: #9b1c1c; }
.badge--warning { background: #fff8e1; color: #8a6d00; }
.badge--success { background: #e8f5e9; color: #1b5e20; }

.table-wrap--timeline { overflow-x: auto; }
.data-table--timeline { min-width: 800px; font-size: 0.82rem; }
.data-table--timeline th,
.data-table--timeline td { min-width: 100px; }
.timeline-time-col { min-width: 60px !important; width: 60px; }
.timeline-cell { vertical-align: top; }
.timeline-booking { margin-bottom: 0.35rem; }
.timeline-booking:last-child { margin-bottom: 0; }

.panel-form { padding: 1rem; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.panel .form-row,
.panel .form-group {
  padding-left: 1rem;
  padding-right: 1rem;
}

.panel .form-row:first-of-type,
.panel > .form-group:first-of-type {
  padding-top: 1rem;
}

.panel .form-row:last-of-type,
.panel > .form-group:last-of-type {
  padding-bottom: 1rem;
}

/* 顧客自動検索 */
.customer-search-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  margin: 0 1rem 1rem;
  overflow: hidden;
}

.customer-search-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}

.customer-search-item {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  text-align: left;
  padding: 12px;
  cursor: pointer;
}

.customer-search-item:last-child {
  border-bottom: 0;
}

.customer-search-item:hover {
  background: #fff8ef;
}

.customer-search-item__title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.customer-search-item__meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.customer-search-item__notes {
  font-size: 0.88rem;
  margin-top: 6px;
  color: var(--ink);
}

.customer-selected-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7fff7;
  padding: 10px 12px;
  margin: 0 1rem 1rem;
}

.form-group--actions { align-self: end; }

.panel__header--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.attention-cell { font-size: 0.82rem; line-height: 1.45; max-width: 220px; }
.attention-cell .badge { margin-bottom: 0.15rem; }

.empty-message {
  padding: 1.25rem 1rem;
  color: var(--muted);
  margin: 0;
}

.customer-note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
}

.customer-note-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fafafa;
}

.customer-note-card h3 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.customer-note-card p { margin: 0 0 0.5rem; font-size: 0.88rem; line-height: 1.5; }
.customer-note-card p:last-child { margin-bottom: 0; }
.note-source { font-size: 0.82rem; color: var(--muted); }

.customer-note-card--danger {
  border-color: #f5c2c2;
  background: #fff5f5;
}
.customer-note-card--danger h3 { color: #9b1c1c; }

.customer-note-card--warning {
  border-color: #ffe082;
  background: #fffde7;
}
.customer-note-card--warning h3 { color: #8a6d00; }

.daily-report-notes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.customer-note-grid--inline {
  padding: 0.75rem 0;
  margin: 0;
}

.customer-detail-row td {
  background: #faf8f5;
  border-bottom: 2px solid var(--border);
}

.table-actions { white-space: nowrap; }
.table-actions .button { margin-right: 0.25rem; }

/* --- スマホ: バーガーメニュー --- */
.mobile-header {
  display: none;
}

.mobile-header__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-header__toggle:hover,
.mobile-header__toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.mobile-header__icon,
.mobile-header__icon::before,
.mobile-header__icon::after {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.mobile-header__icon {
  position: relative;
}

.mobile-header__icon::before,
.mobile-header__icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.mobile-header__icon::before { top: -6px; }
.mobile-header__icon::after { top: 6px; }

body.is-sidebar-open .mobile-header__icon {
  background: transparent;
}

body.is-sidebar-open .mobile-header__icon::before {
  top: 0;
  transform: rotate(45deg);
}

body.is-sidebar-open .mobile-header__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.mobile-header__title {
  min-width: 0;
  line-height: 1.25;
}

.mobile-header__title-link {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.mobile-header__title-link:hover .mobile-header__title-main {
  text-decoration: underline;
}

.mobile-header__title-main {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.mobile-header__title-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 3.25rem;
    padding: 0 0.75rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    border: none;
    margin: 0;
    padding: 0;
    background: rgba(26, 20, 16, 0.45);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  body.is-sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .layout-with-sidebar {
    margin-left: 0;
    padding-top: 3.25rem;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(17.5rem, 88vw);
    height: 100vh;
    height: 100dvh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  body.is-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(26, 20, 16, 0.12);
  }

  body.is-sidebar-open {
    overflow: hidden;
  }

  .content { padding: 1rem; }
  .data-table th { width: 100px; }
}
