/* ==================== カラーパレット ==================== */
:root {
  --black: #1a1a1a;
  --dark: #2d2d2d;
  --gray-800: #3a3a3a;
  --gray-600: #6b6b6b;
  --gray-400: #a0a0a0;
  --gray-200: #e5e5e5;
  --gray-100: #f5f5f4;
  --gray-50: #fafaf9;
  --white: #ffffff;
  --gold: #b8963e;
  --gold-light: #d4b061;
  --gold-subtle: #f7f3ea;
  --gold-border: rgba(184, 150, 62, 0.25);
  --danger: #dc3545;
  --success: #28a745;
  --warning: #f59e0b;
  --sidebar-width: 240px;
  --header-height: 56px;
  --bottom-nav-height: 64px;
}

/* ==================== リセット ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--black);
  background: var(--gray-100);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ==================== 画面切替 ==================== */
.screen { display: none; }
.screen.active { display: block; }

/* ==================== ログイン画面 ==================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #f8f6f0 0%, #eee9dd 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 2px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 3px;
  margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.pw-wrapper {
  position: relative;
}

.pw-wrapper input {
  padding-right: 48px;
}

.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--gray-400);
  display: flex;
  align-items: center;
}

.pw-toggle:hover { color: var(--gold); }

.remember-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--gray-600);
  cursor: pointer;
}

.remember-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

/* ==================== アプリヘッダー ==================== */
.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 56px;
}

.app-title {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.btn-logout {
  display: flex;
  align-items: center;
  padding: 4px;
  color: var(--gray-400);
  text-decoration: none;
  border-radius: 4px;
  margin-left: 8px;
}
.btn-logout:hover {
  color: var(--danger);
  background: var(--gray-100);
}

.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  color: var(--gray-600);
  min-width: 40px;
  min-height: 40px;
  justify-content: center;
}

.btn-back:hover { background: var(--gray-100); color: var(--gold); }

/* ==================== コンテナ ==================== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}

/* ==================== カード ==================== */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==================== フォーム ==================== */
.form-group {
  display: flex;
  flex-direction: column;
}

/* グリッド外のform-groupのみmargin */
.card > .form-group {
  margin-bottom: 16px;
}
.card > .form-group:last-child { margin-bottom: 0; }

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.required { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* iOS自動ズーム防止 */
  font-family: inherit;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-border);
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

.text-right { text-align: right; }

.char-count {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-align: right;
  margin-top: 4px;
}

/* === 備考行入力 === */
.remarks-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.remarks-line-group,
.item-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.remark-line-input,
.item-name-group input {
  flex: 1;
  min-width: 0;
}

.remark-line-count {
  font-size: 0.75rem;
  color: var(--gray-400);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-grid-2col .form-group {
  margin-bottom: 0;
}

.form-full { grid-column: 1 / -1; }

/* ==================== ボタン ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  min-height: 48px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--white);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(184, 150, 62, 0.35);
}

.btn-outline {
  background: var(--white);
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-subtle);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(220, 53, 69, 0.35);
}

.btn-full { width: 100%; }
.btn-sm { padding: 10px 16px; font-size: 0.85rem; min-height: 40px; }
.btn-grow { flex: 1; }

.btn-send {
  font-size: 1.1rem;
  padding: 16px 24px;
  min-height: 56px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==================== メニューグリッド ==================== */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
  min-height: 100px;
  text-decoration: none;
}

.menu-btn:hover {
  border-color: var(--gold);
  background: var(--gold-subtle);
  color: var(--gold);
}

.menu-btn:active { transform: scale(0.97); }

.menu-btn .material-icons {
  font-size: 28px;
  color: var(--gold);
}

.menu-btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--white);
  border-color: transparent;
  grid-column: 1 / -1;
  flex-direction: row;
  padding: 28px 20px;
  font-size: 1.1rem;
}

.menu-btn-primary .material-icons {
  color: var(--white);
  font-size: 32px;
}

.menu-btn-primary:hover {
  box-shadow: 0 4px 16px rgba(184, 150, 62, 0.35);
}

/* ==================== リマインダーカード ==================== */
.reminder-card {
  border-left: 4px solid var(--warning);
}

.reminder-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.reminder-item:last-child { border-bottom: none; }

.reminder-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.reminder-sub {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-top: 4px;
  padding-left: 4px;
}

/* ==================== 統計 ==================== */
.stats-row {
  display: flex;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.stat-box {
  flex: 1;
  text-align: center;
  padding: 16px 8px;
  border-right: 1px solid var(--gray-200);
}

.stat-box:last-child { border-right: none; }

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-top: 4px;
}

/* ==================== バッジ ==================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ==================== 納期切替 ==================== */
.delivery-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.toggle-btn {
  flex: 1;
  padding: 10px;
  background: var(--white);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: all 0.2s;
  min-height: 44px;
}

.toggle-btn.active {
  background: var(--gold);
  color: var(--white);
}

/* ==================== テーブル ==================== */
.table-scroll { overflow-x: auto; }

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

.table th {
  background: var(--gray-50);
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-800);
  border-top: 2px solid var(--black);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 8px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table td input {
  min-height: 44px;
  padding: 10px 12px;
}

.cell-center { text-align: center; }
.cell-number { text-align: right; font-feature-settings: 'tnum'; white-space: nowrap; }

/* ==================== データテーブル（一覧表示用） ==================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--gray-50);
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-800);
  border-top: 2px solid var(--black);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  font-size: 0.9rem;
}

.data-table tbody tr:hover {
  background: var(--gold-subtle);
}

.data-table .text-right {
  text-align: right;
}

.data-table .text-center {
  text-align: center;
}

/* ==================== 明細カード（スマホ） ==================== */
.item-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.item-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
}

.item-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  min-width: 32px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
}

.item-delete:hover { color: var(--danger); }

.item-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.item-card-amount {
  text-align: right;
  font-size: 0.95rem;
  color: var(--gray-800);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
}

/* ==================== 合計 ==================== */
.totals-box {
  margin-top: 20px;
  border: 2px solid var(--black);
  border-left: 5px solid var(--gold);
  border-radius: 6px;
  overflow: hidden;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--gray-100);
}

.totals-row:last-child { border-bottom: none; }

.totals-grand {
  background: var(--gray-50);
  border-top: 2px solid var(--black);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 14px 16px;
}

/* ==================== ファイルアップロード ==================== */
.file-drop-area {
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 0.9rem;
}

.file-drop-area:hover {
  border-color: var(--gold);
  background: var(--gold-subtle);
  color: var(--gold);
}

.file-hint {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.file-list { margin-top: 8px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.file-name {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  display: flex;
  min-width: 56px;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.file-remove .material-icons {
  font-size: 32px;
}

.file-remove:hover { color: var(--danger); }

/* ==================== 引き継ぎファイル ==================== */
.inherited-files {
  margin-bottom: 12px;
}

.inherited-files-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 8px;
  font-weight: 500;
}

.inherited-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--gold-subtle);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  margin-bottom: 6px;
}

.inherited-file-item.excluded {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.inherited-file-item .file-name {
  flex: 1;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-file-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  color: var(--gray-600);
  text-decoration: none;
  flex-shrink: 0;
}

.btn-file-action .material-icons {
  font-size: 32px;
}

.btn-file-action:hover {
  background: rgba(0,0,0,0.05);
}

.btn-file-exclude {
  color: var(--danger);
}

.btn-file-exclude:hover {
  background: rgba(220,53,69,0.08);
}

/* ==================== 固定フッター ==================== */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 12px 16px;
  z-index: 99;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.sticky-footer .btn-full {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
}

.sticky-footer-row {
  display: flex;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}

/* ==================== メール画面 ==================== */
.mail-readonly {
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--gray-600);
  min-height: 48px;
  display: flex;
  align-items: center;
}

/* ==================== 発注完了 ==================== */
.complete-icon {
  margin-bottom: 16px;
}

.complete-icon .material-icons {
  font-size: 64px;
  color: var(--success);
}

.complete-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.complete-info {
  font-size: 1rem;
  color: var(--gray-600);
  line-height: 2;
}

/* ==================== PDFプレビュー ==================== */
.pdf-preview {
  background: #e8e8e8;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
}

.pdf-page {
  background: var(--white);
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  position: relative;
  font-size: 12px;
}

.pdf-gold-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.pdf-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
}

.pdf-doc-no {
  font-size: 9px;
  color: var(--gray-600);
  margin-top: 4px;
}

.pdf-date {
  font-size: 11px;
  color: var(--gray-800);
}

.pdf-info {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.pdf-dest { flex: 1.2; }
.pdf-issuer { flex: 1; }

.pdf-dest-name {
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid var(--black);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.pdf-honorific { font-size: 10px; color: var(--gray-600); }

.pdf-meta { font-size: 9px; color: var(--gray-600); }

.pdf-delivery-box {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--gold);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 6px 10px;
  margin-top: 6px;
  background: var(--gold-subtle);
}

.pdf-delivery-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--gold);
  width: 40px;
  flex-shrink: 0;
}

.pdf-delivery-value {
  font-size: 11px;
  font-weight: 700;
}

.pdf-issuer {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 10px;
}

.pdf-company { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.pdf-address { font-size: 8px; color: var(--gray-600); margin-bottom: 4px; }
.pdf-tel { font-size: 8px; }

.pdf-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 2px solid var(--black);
  border-left: 5px solid var(--gold);
  border-radius: 4px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-size: 10px;
}

.pdf-total-bar strong { font-size: 18px; }

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 11px;
}

.pdf-table th {
  background: var(--gray-50);
  border-top: 2px solid var(--black);
  border-bottom: 1px solid var(--gray-200);
  padding: 6px;
  text-align: left;
  font-size: 10px;
}

.pdf-table td {
  padding: 6px;
  border-bottom: 1px solid var(--gray-100);
}

.pdf-table td:nth-child(3),
.pdf-table td:nth-child(4),
.pdf-table td:nth-child(5) {
  text-align: right;
}

.pdf-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.pdf-totals > div {
  display: flex;
  justify-content: space-between;
  width: 200px;
  padding: 4px 6px;
  font-size: 10px;
  border-bottom: 1px solid var(--gray-100);
}

.pdf-totals-grand {
  border-top: 2px solid var(--black);
  border-bottom: 2px solid var(--black) !important;
  font-weight: 700;
  font-size: 12px !important;
  padding: 6px !important;
  background: var(--gray-50);
}

/* ==================== フラッシュメッセージ ==================== */
.flash-message {
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.flash-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.flash-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ==================== ローディングオーバーレイ ==================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ==================== モーダルダイアログ ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 16px;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-body {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 20px;
  color: var(--black);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ==================== ページネーション ==================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-item {
  list-style: none;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.page-link:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-subtle);
}

.page-active .page-link,
.page-link.active {
  background: var(--gold);
  color: var(--white);
  border-color: var(--gold);
}

.page-link.disabled {
  color: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.5;
}

/* ==================== トグルスイッチ ==================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray-400);
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-switch .slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .slider {
  background: var(--success);
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(22px);
}

/* ==================== 検索バー ==================== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.search-bar input[type="text"],
.search-bar input[type="search"],
.search-bar select {
  flex: 1;
  min-width: 150px;
}

.search-bar .btn {
  flex-shrink: 0;
}

/* ==================== 空状態表示 ==================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}

.empty-state .material-icons {
  font-size: 48px;
  margin-bottom: 12px;
  color: var(--gray-200);
}

.empty-state p {
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ==================== PC/スマホ切替 ==================== */
.pc-only { display: block; }
.sp-only { display: none; }

/* ==================== レスポンシブ ==================== */
@media (max-width: 640px) {
  .container { padding: 12px 12px 164px; }

  .card { padding: 16px; border-radius: 10px; }

  .form-grid-2col {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-full { grid-column: auto; }

  .menu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .menu-btn {
    padding: 18px 12px;
    font-size: 0.85rem;
    min-height: 88px;
  }

  .menu-btn-primary {
    padding: 22px 16px;
    font-size: 1rem;
  }

  /* 明細：テーブル→カード切替 */
  .pc-only { display: none; }
  .sp-only { display: block; }

  /* フッターボタン */
  .sticky-footer { padding: 10px 12px; }

  .actions {
    flex-direction: column;
  }

  .actions .btn { width: 100%; }

  /* PDF プレビュー */
  .pdf-preview { padding: 8px; }
  .pdf-page { padding: 20px 16px; }
  .pdf-info { flex-direction: column; gap: 12px; }
  .pdf-title { font-size: 18px; letter-spacing: 4px; }
  .pdf-total-bar strong { font-size: 16px; }

  /* 統計 */
  .stat-number { font-size: 1.5rem; }

  /* 完了画面 */
  .complete-icon .material-icons { font-size: 52px; }
  .complete-title { font-size: 1.1rem; }

  /* ログイン */
  .login-card { padding: 32px 24px; }

  /* 検索バー */
  .search-bar {
    flex-direction: column;
  }

  .search-bar input[type="text"],
  .search-bar input[type="search"],
  .search-bar select {
    width: 100%;
  }

  /* スマホ: ボトムナビ分の余白 */
  .main-content { padding-bottom: var(--bottom-nav-height); }
  /* スマホ: sticky-footerをボトムナビの上に配置 */
  .sticky-footer { bottom: var(--bottom-nav-height); }
}

@media (min-width: 641px) {
  .card { padding: 24px 28px; }
  .container { padding: 20px 24px 100px; max-width: 1200px; }

  .menu-btn {
    min-height: 110px;
  }

  /* PC: 明細テーブル表示 */
  .table td input {
    min-height: 44px;
  }

  /* PC: PDFプレビュー横並び復活 */
  .pdf-info {
    flex-direction: row;
  }

  /* PC: 合計ボックス右寄せ */
  .totals-box {
    max-width: 320px;
    margin-left: auto;
  }

  /* PC: sticky footer制限 */
  .sticky-footer .btn-full,
  .sticky-footer-row {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  /* PC: ヘッダーをfixed化（サイドバー分オフセット） */
  .app-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 100;
  }
  .app-header-inner {
    max-width: none;
  }

  .sticky-footer {
    left: var(--sidebar-width);
  }
}

/* ==================== サイドバー（PC専用） ==================== */
.sidebar { display: none; }

@media (min-width: 641px) {
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--black); color: #fff;
    z-index: 150; overflow-y: auto;
  }
  .sidebar-logo {
    padding: 20px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .sidebar-logo-title { font-size: 1.05rem; font-weight: 700; color: var(--gold); }
  .sidebar-logo-sub { font-size: 0.72rem; color: var(--gray-400); margin-top: 2px; }
  .sidebar-nav { flex: 1; padding: 12px 0; }
  .sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; color: var(--gray-400);
    text-decoration: none; font-size: 0.9rem; font-weight: 500;
    transition: all 0.15s; cursor: pointer;
    border-left: 3px solid transparent;
  }
  .sidebar-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
  .sidebar-item.active { background: rgba(196,164,95,0.12); color: var(--gold); border-left-color: var(--gold); }
  .sidebar-item .material-icons { font-size: 20px; width: 24px; text-align: center; }
  .sidebar-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 16px; }
  .sidebar-footer { padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.08); }
}

/* ==================== メインコンテンツラッパー ==================== */
.main-content { min-height: 100vh; }

@media (min-width: 641px) {
  .main-content { margin-left: var(--sidebar-width); padding-top: var(--header-height); }
}

/* ==================== ボトムナビ（スマホ専用） ==================== */
.bottom-nav { display: none; }

@media (max-width: 640px) {
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-height);
    background: var(--white); border-top: 1px solid var(--gray-200);
    z-index: 200; align-items: center; justify-content: space-around;
    padding: 0 4px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  .bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 6px 0; color: var(--gray-400);
    text-decoration: none; font-size: 0.65rem; font-weight: 600;
    min-width: 56px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item .material-icons { font-size: 24px; }
  .bottom-nav-item.active { color: var(--gold); }
}

/* ==================== ボトムシート ==================== */
.bottom-sheet-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 300;
}
.bottom-sheet-overlay.open { display: block; }
.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white); border-radius: 20px 20px 0 0;
  padding: 8px 0 24px; z-index: 301;
  transform: translateY(100%); transition: transform 0.3s ease;
}
.bottom-sheet-overlay.open .bottom-sheet { transform: translateY(0); }
.bottom-sheet-handle { width: 40px; height: 4px; background: var(--gray-300); border-radius: 2px; margin: 8px auto 16px; }
.bottom-sheet-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; font-size: 0.95rem; font-weight: 500;
  color: var(--black); cursor: pointer; text-decoration: none;
}
.bottom-sheet-item:hover { background: var(--gray-50); }
.bottom-sheet-item .material-icons { font-size: 22px; color: var(--gray-500); }
.bottom-sheet-item.danger { color: #e74c3c; }
.bottom-sheet-item.danger .material-icons { color: #e74c3c; }

/* ==================== ダッシュボード改修 ==================== */

/* タブ */
.dash-tabs { display:flex; gap:8px; margin-bottom:16px; }
.dash-tab { flex:1; padding:12px 16px; min-height:48px; border:1.5px solid var(--gray-200); border-radius:10px; background:var(--white); font-size:0.9rem; font-weight:600; color:var(--gray-600); cursor:pointer; transition:all 0.2s; display:flex; align-items:center; justify-content:center; gap:8px; }
.dash-tab.active { border-color:var(--gold); color:var(--gold); background:var(--gold-subtle); }
.dash-tab-badge { background:var(--gray-200); color:var(--gray-600); padding:2px 8px; border-radius:10px; font-size:0.78rem; font-weight:700; min-width:24px; text-align:center; }
.dash-tab.active .dash-tab-badge { background:var(--gold); color:var(--white); }

/* PCテーブル */
.dash-table { overflow-x:auto; }
.dash-table .data-table { width:100%; }
.dash-table .data-table tbody tr { cursor:pointer; transition:background 0.15s; }
.dash-table .data-table tbody tr:hover { background:var(--gray-50); }
.dash-item-sub { font-size:0.78rem; color:var(--gray-400); margin-left:4px; }

/* スマホカード */
.dash-cards { display:none; }
.dash-card { background:var(--white); border:1px solid var(--gray-200); border-radius:10px; margin-bottom:10px; overflow:hidden; }
.dash-card-summary { padding:14px 16px; cursor:pointer; display:flex; flex-direction:column; gap:4px; }
.dash-card-supplier { font-weight:700; font-size:0.95rem; }
.dash-card-meta { display:flex; justify-content:space-between; align-items:center; font-size:0.85rem; color:var(--gray-600); }
.dash-card-product { font-size:0.85rem; color:var(--gray-600); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-card-detail { display:none; padding:0 16px 14px; border-top:1px solid var(--gray-100); }
.dash-card-detail.open { display:block; }
.dash-card-detail-row { display:flex; justify-content:space-between; padding:6px 0; font-size:0.85rem; border-bottom:1px solid var(--gray-50); }
.dash-card-detail-row:last-child { border-bottom:none; }
.dash-card-detail-total { display:flex; justify-content:space-between; padding:8px 0 0; font-weight:700; font-size:0.9rem; border-top:1px solid var(--gray-200); margin-top:4px; }

/* ページネーション */
.dash-pagination { display:flex; justify-content:center; gap:4px; margin-top:16px; flex-wrap:wrap; }
.dash-pagination button { min-width:48px; min-height:48px; border:1px solid var(--gray-200); background:var(--white); border-radius:8px; cursor:pointer; font-size:0.9rem; transition:all 0.15s; }
.dash-pagination button:active { transform:scale(0.95); }
.dash-pagination button.active { background:var(--gold); color:var(--white); border-color:var(--gold); }
.dash-pagination button:disabled { opacity:0.4; cursor:default; }

/* ステータスバッジ */
.status-badge { display:inline-block; padding:2px 10px; border-radius:12px; font-size:0.8rem; font-weight:600; white-space:nowrap; }
.status-ordered { background:#e3f2fd; color:#1565c0; }
.status-waiting { background:#fff3e0; color:#e65100; }
.status-completed { background:#e8f5e9; color:#2e7d32; }
.status-bounce-error { background:#fde8e8; color:#e74c3c; }

/* レスポンシブ切替 */
@media (max-width: 640px) {
  .dash-table { display:none; }
  .dash-cards { display:block; }
}
