*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', sans-serif;
  background: #f4f6f8;
  color: #333;
  min-height: 100vh;
}

/* ---- Navbar ---- */
.navbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: #1a1a2e;
  color: #fff;
}
.navbar span { flex: 1; }

/* ---- Center layout (login / index) ---- */
.center-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 20px;
}
.center-box h1 { font-size: 2rem; }

/* ---- Main container ---- */
.container {
  max-width: 800px;
  margin: 32px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.container-wide { max-width: 1200px; }

/* ---- Card ---- */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card h2 { font-size: 1.1rem; border-bottom: 1px solid #eee; padding-bottom: 8px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background .2s;
}
.btn:hover { background: #16213e; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }

/* ---- Form ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 280px;
}
.form-group label { font-size: 0.9rem; font-weight: 600; }
.form-group input {
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: #1a1a2e; }

/* ---- Links list ---- */
.link-list { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Error ---- */
.error { color: #e74c3c; font-size: 0.9rem; }
.muted { color: #999; font-size: 0.9rem; }

/* ---- Chat ---- */
.chat-box {
  height: 320px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  display: flex;
  gap: 8px;
  align-items: baseline;
  max-width: 80%;
}
.chat-msg.self { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.other { align-self: flex-start; }
.chat-sender { font-size: 0.75rem; font-weight: 700; color: #666; white-space: nowrap; }
.chat-text {
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 0.95rem;
  word-break: break-word;
}
.chat-msg.self .chat-text { background: #1a1a2e; color: #fff; }
.chat-msg.other .chat-text { background: #e8e8e8; color: #333; }

.chat-form {
  display: flex;
  gap: 8px;
}
.chat-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}
.chat-form input:focus { outline: none; border-color: #1a1a2e; }

/* ---- Settings 2-column layout ---- */
.settings-layout {
  display: flex;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  min-height: 420px;
  overflow: hidden;
}
.settings-nav {
  width: 200px;
  border-right: 1px solid #eee;
  padding: 12px 0;
  flex-shrink: 0;
}
.settings-nav-item {
  display: block;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background .15s;
}
.settings-nav-item:hover { background: #f4f6f8; }
.settings-nav-item.active { background: #1a1a2e; color: #fff; }
.settings-content {
  flex: 1;
  padding: 28px;
}
.settings-content h2 {
  font-size: 1.1rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 0;
}

/* ---- Manage header ---- */
.manage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.manage-header h2 {
  font-size: 1.1rem;
  border-bottom: none;
  padding-bottom: 0;
}

/* ---- Manage table ---- */
.manage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.manage-table th, .manage-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
}
.manage-table th {
  background: #f4f6f8;
  font-weight: 600;
  color: #555;
}
.manage-table tr.row-visible td { background: #fff; }
.manage-table tr.row-hidden td { background: #f0f0f0; color: #888; }
.td-actions { white-space: nowrap; gap: 4px; display: flex; align-items: center; }

/* ---- Toggle button ---- */
.btn-toggle { background: #6c757d; }
.btn-toggle:hover { background: #5a6268; }

/* ---- Sort link ---- */
.sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.sort-link:hover { text-decoration: underline; }

/* ---- Manage form ---- */
.manage-form { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-row label {
  width: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
}
.form-row input[type="text"],
.form-row input[type="number"],
.form-row select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}
.form-row input[type="text"]:focus,
.form-row input[type="number"]:focus,
.form-row select:focus { outline: none; border-color: #1a1a2e; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---- Button variants ---- */
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
  background: transparent;
  color: #1a1a2e;
  border: 1px solid #1a1a2e;
}
.btn-outline:hover { background: #f4f6f8; }

/* ---- Required mark ---- */
.required { color: #e74c3c; font-size: 0.85rem; }

/* ---- Nav divider ---- */
.nav-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 8px 12px;
}

/* ---- Table status badge ---- */
.table-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-free   { background: #e8f5e9; color: #2e7d32; }
.status-in-use { background: #fce4ec; color: #c62828; }

/* ---- Store form ---- */
.store-form { max-width: 560px; }
.store-section { margin-bottom: 28px; }
.store-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #555;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}
.zip-group { display: flex; gap: 8px; flex: 1; }
.zip-group input { flex: 1; }

/* ---- Business hours table ---- */
.hours-table { border-collapse: collapse; width: 100%; max-width: 400px; }
.hours-table th, .hours-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
}
.hours-table th { background: #f4f6f8; font-size: 0.85rem; color: #555; font-weight: 600; }
.hours-table input[type="time"] {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}
.hours-table input[type="time"]:focus { outline: none; border-color: #1a1a2e; }
.dow-label { font-size: 0.9rem; font-weight: 600; width: 60px; }

/* ---- Device test result ---- */
.test-result { font-size: 0.88rem; }
.test-ok   { color: #2e7d32; }
.test-fail { color: #c62828; }
.dow-sun { color: #e74c3c; }
.dow-sat { color: #2980b9; }
.hours-table { max-width: 580px; }
.hours-table th[colspan] { text-align: center; background: #eef1f5; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 28px;
  width: 440px;
  max-width: 92vw;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: #f0f0f0; color: #333; }

/* ---- Trust device checkbox ---- */
.trust-device-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
  margin-top: 4px;
}

/* ---- 消費税設定テーブル ---- */
.tax-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.tax-table th, .tax-table td {
  padding: 10px 14px;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: middle;
}
.tax-table thead th {
  background: #f4f6f8;
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
}
.tax-label {
  font-weight: 700;
  white-space: nowrap;
  background: #fafafa;
}
.radio-group {
  display: flex;
  gap: 20px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1a1a2e;
}
.tax-rate-input {
  width: 80px !important;
  text-align: right;
}

/* ---- テイクアウトバッジ ---- */
.badge-takeout {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: #e67e22;
  border-radius: 4px;
  vertical-align: middle;
}

/* ---- チェックボックス行 ---- */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1a1a2e;
}

/* ---- カテゴリ表示先バッジ ---- */
.badge-pos {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 4px;
}
.badge-pos.cook    { background: #e8f5e9; color: #2e7d32; }
.badge-pos.counter { background: #e3f2fd; color: #1565c0; }

/* ---- 提供済ラベル（オーダー履歴） ---- */
.provided-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1565c0;
  background: #e3f2fd;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}
