@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500&family=Lato:wght@300;400&display=swap');

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

:root {
  --bg: #FDF5F3;
  --surface: #FFFFFF;
  --border: #EBDDD8;
  --text-primary: #2D2118;
  --text-secondary: #8C7B74;
  --accent: #9C7B6E;
  --accent-light: #F6EDEA;
  --danger: #B5484A;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

body {
  font-family: 'Noto Sans JP', 'Lato', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Login ─────────────────────────────── */

.login-wrap {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

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

.login-logo .brand {
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  font-size: 22px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.login-logo .sub {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.btn {
  display: block;
  width: 100%;
  padding: 13px;
  margin-top: 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
  margin-top: 12px;
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  min-height: 18px;
}

/* ─── Portal Layout ──────────────────────── */

.portal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.portal-brand {
  display: flex;
  align-items: center;
}

.header-logo {
  height: 18px;
  width: auto;
  display: block;
}

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.portal-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ─── Section ────────────────────────────── */

.section {
  margin-bottom: 48px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── MVV Card ───────────────────────────── */

.mvv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.mvv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.mvv-card .mvv-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.mvv-card .mvv-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 10px;
  line-height: 1.4;
}

.mvv-card .mvv-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ─── MVV Doc Card ───────────────────────── */

.mvv-doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.mvv-doc-label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.mvv-doc-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.doc-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.doc-btn:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .mvv-doc-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .doc-btn { width: 100%; text-align: center; }
}

/* ─── Link Cards (資料) ─────────────────── */

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s;
}

.link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.link-card .link-text {
  font-size: 13px;
  line-height: 1.4;
}

.link-badge {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 4px;
  flex-shrink: 0;
}

.link-badge.new {
  background: var(--accent);
  color: #fff;
}

.link-badge.past {
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── Manual Controls ────────────────────── */

.manual-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.manual-control-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.manual-controls .control-label {
  display: none;
}

.manual-search {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.manual-search:focus {
  border-color: var(--accent);
}

/* ─── Pagination ─────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── Manual List ────────────────────────── */

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── マニュアル カテゴリフィルター（横スクロール） ── */
.manual-filter {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.manual-filter::-webkit-scrollbar { display: none; }

.manual-count {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ── マニュアル カード ── */
.manual-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.manual-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.manual-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.manual-card:active {
  transform: scale(0.99);
}

.manual-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.manual-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.manual-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.manual-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
}

.manual-tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.manual-required-badge {
  display: inline-block;
  background: #FFF3E0;
  color: #E65100;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.manual-card-arrow {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 12px;
  opacity: 0.5;
}

.manual-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ── マニュアル モーダル ── */
.manual-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.15s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 600px) {
  .manual-modal-overlay {
    align-items: center;
    padding: 16px;
  }
}
body.modal-open {
  overflow: hidden;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.manual-modal {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  max-width: 720px;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 20px calc(env(safe-area-inset-bottom, 0px) + 32px);
  position: relative;
  animation: slideUp 0.2s ease;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 600px) {
  .manual-modal {
    border-radius: var(--radius);
    max-height: 85vh;
    padding: 28px;
  }
}

.manual-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
@media (min-width: 600px) {
  .manual-modal-handle { display: none; }
}

.manual-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.manual-modal-close:hover {
  background: var(--border);
}

.manual-modal-title {
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 6px;
  padding-right: 40px;
  line-height: 1.4;
}
.manual-modal-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.manual-modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 20px;
}

.manual-modal-body {
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-primary);
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}
.manual-modal-body h1 { font-size: 17px; font-weight: 500; margin: 24px 0 10px; }
.manual-modal-body h2 { font-size: 15px; font-weight: 500; margin: 20px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.manual-modal-body h3 { font-size: 14px; font-weight: 500; margin: 16px 0 6px; }
.manual-modal-body p { margin-bottom: 12px; }
.manual-modal-body ul, .manual-modal-body ol { padding-left: 20px; margin-bottom: 14px; }
.manual-modal-body li { margin-bottom: 6px; }
.manual-modal-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 14px;
  margin: 12px 0;
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}
.manual-modal-body code {
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 13px;
  word-break: break-all;
}
.manual-modal-body pre {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 14px;
  max-width: 100%;
}
.manual-modal-body pre code { background: none; padding: 0; word-break: normal; }
.manual-modal-body input[type="checkbox"] {
  margin-right: 6px;
  accent-color: var(--accent);
}
.manual-modal-body table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  display: block;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 13px;
}
.manual-modal-body th, .manual-modal-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.manual-modal-body th {
  background: var(--bg);
  font-weight: 500;
}
.manual-modal-body img {
  max-width: 100%;
  height: auto;
}

/* ── マニュアル管理者バー ── */
.manual-admin-bar {
  margin-bottom: 12px;
}
.manual-create-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.manual-create-btn:hover { opacity: 0.85; }

/* ── マニュアル管理者アクション ── */
.manual-manager-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.manual-action-btn {
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.manual-action-edit {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.manual-action-edit:hover { border-color: var(--accent); }
.manual-action-ai {
  background: var(--accent);
  color: #fff;
}
.manual-action-ai:hover { opacity: 0.85; }
.manual-action-ai:disabled { opacity: 0.5; cursor: not-allowed; }
.manual-action-delete {
  background: none;
  color: var(--danger);
  margin-left: auto;
  font-size: 11px;
}
.manual-action-delete:hover { text-decoration: underline; }
.manual-action-cancel {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.manual-action-save {
  background: var(--accent);
  color: #fff;
}
.manual-action-save:hover { opacity: 0.85; }
.manual-action-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── マニュアル編集フォーム ── */
.manual-edit-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.manual-edit-field {
  margin-bottom: 12px;
}
.manual-edit-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.manual-edit-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: var(--bg);
}
.manual-edit-input:focus { border-color: var(--accent); }
.manual-edit-textarea {
  width: 100%;
  min-height: 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: var(--bg);
}
.manual-edit-textarea:focus { border-color: var(--accent); }
.manual-edit-row {
  margin-bottom: 12px;
}
.manual-edit-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.manual-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.manual-edit-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.manual-edit-status.success { color: #27ae60; }
.manual-edit-status.error { color: var(--danger); }

/* ── AI修正セクション ── */
.manual-ai-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.manual-ai-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.manual-correction-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: var(--bg);
}
.manual-correction-textarea:focus {
  border-color: var(--accent);
}
.manual-ai-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}
.manual-ai-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.manual-ai-preview-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.manual-ai-preview-tabs {
  display: flex;
  gap: 4px;
}
.manual-ai-tab {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.manual-ai-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.manual-ai-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
}
.manual-ai-preview h1, .manual-ai-preview h2, .manual-ai-preview h3 {
  margin-top: 12px;
  margin-bottom: 6px;
}
.manual-ai-confirm {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* ── MVV 埋め込み ── */
.mvv-embed-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 aspect ratio */
}
.mvv-embed-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.loading {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ─── Header Nav ─────────────────────────── */

.header-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 210;
}
.nav-burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.25s;
}
.header-nav.open .nav-burger span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.header-nav.open .nav-burger span:nth-child(2) {
  opacity: 0;
}
.header-nav.open .nav-burger span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-overlay {
  display: none;
}

.nav-link {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* ─── Mobile hamburger ──────────────────── */
@media (max-width: 600px) {
  .nav-burger {
    display: flex;
  }
  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 220px;
    height: 100dvh;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 64px 16px 24px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    z-index: 200;
    overflow-y: auto;
  }
  .header-nav.open .nav-menu {
    display: flex;
  }
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: rgba(0,0,0,0.3);
    z-index: 190;
  }
  .header-nav.open .nav-overlay {
    display: block;
  }
  .nav-link {
    font-size: 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .nav-link.active {
    background: var(--accent-light);
    font-weight: 500;
  }
  .logout-btn {
    margin-top: 12px;
    text-align: center;
  }
}

/* ─── Mypage Controls ────────────────────── */

.mypage-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  overflow: hidden;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.control-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.mypage-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.mypage-select:focus {
  border-color: var(--accent);
}

/* ─── Staff Target Card (Admin) ──────────── */

.staff-target-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.target-card-header {
  font-weight: 500;
  margin-bottom: 8px;
}
.target-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.target-fields label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ─── Goal Card ──────────────────────────── */

.goal-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.goal-metric {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
}
.goal-metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.goal-metric-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}
.goal-theme {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.goal-theme-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.goal-theme-text {
  font-size: 13px;
  line-height: 1.5;
}

/* ─── Progress Bar ───────────────────────── */

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.progress-divider {
  color: var(--border);
}

/* ─── Metric Cards ───────────────────────── */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: var(--radius);
}

.metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 20px;
  font-weight: 500;
}

.metric-value.good { color: #27ae60; }
.metric-value.warn { color: #e67e22; }

.metric-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ─── Input Form ─────────────────────────── */

.input-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.input-group {
  margin-bottom: 16px;
}
.input-group .control-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.input-number {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.input-number:focus {
  border-color: var(--accent);
}

.counter-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 8px;
}
.counter-section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}
.toggle-label {
  font-size: 13px;
  color: var(--text-primary);
}
.counter-control {
  display: flex;
  align-items: center;
  gap: 12px;
}
.counter-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  line-height: 1;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.counter-btn:active {
  background: var(--accent-light);
  border-color: var(--accent);
}
.counter-value {
  font-size: 18px;
  font-weight: 500;
  min-width: 24px;
  text-align: center;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.save-btn {
  margin-top: 0;
}

.delete-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  margin-top: 0;
  font-size: 13px;
}

.delete-btn:hover {
  background: var(--danger);
  color: #fff;
}

.save-message {
  text-align: center;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

/* ─── Calendar ───────────────────────────── */

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.day-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  padding: 2px;
}

.day-cell.worked {
  background: #E6F1FB;
  border: 1px solid #B5D4F4;
}

.day-cell.off {
  background: var(--bg);
  border: 1px solid var(--border);
}

.day-cell.clickable {
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.day-cell.clickable:active {
  transform: scale(0.95);
}

.day-cell.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.day-num {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-primary);
}

.day-sales {
  font-size: 8px;
  color: var(--accent);
  font-weight: 500;
}

/* ─── Breakdown ──────────────────────────── */

.breakdown-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breakdown-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.breakdown-data {
  font-size: 13px;
  color: var(--text-primary);
  margin-right: 12px;
}

.breakdown-rate {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  min-width: 48px;
  text-align: right;
}

/* ─── Chart ──────────────────────────────── */

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  height: 260px;
}

/* ─── Ranking ────────────────────────────── */

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  background: var(--accent-light);
  color: var(--accent);
}

.rank-badge.rank-1 {
  background: #F9E547;
  color: #7A6500;
}

.rank-badge.rank-2 {
  background: #D1D5DB;
  color: #4B5563;
}

.rank-badge.rank-3 {
  background: #FBBF7B;
  color: #7C4A00;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name {
  font-size: 14px;
  font-weight: 500;
}

.rank-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.rank-value-wrap {
  text-align: right;
  flex-shrink: 0;
}

.rank-value {
  font-size: 16px;
  font-weight: 500;
}

.rank-value.good { color: #27ae60; }
.rank-value.warn { color: #e67e22; }

.rank-pct {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.rank-pct.achieved {
  color: #27ae60;
  font-weight: 500;
}

.ranking-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ─── Shift Upload ──────────────────────── */

.shift-upload-btn {
  font-size: 11px;
  color: var(--surface);
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-left: auto;
}

.shift-upload-btn:hover {
  opacity: 0.85;
}

.shift-status {
  font-size: 12px;
  margin-bottom: 8px;
  min-height: 18px;
}

.day-cell.shift {
  background: #FFF3E0;
  border: 1px solid #FFB74D;
}

.day-shift-mark {
  font-size: 7px;
  color: #E65100;
  font-weight: 500;
}

.shift-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
}

/* ─── CSV Upload ────────────────────────── */

.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  transition: border-color 0.2s;
}

.upload-area:hover {
  border-color: var(--accent);
}

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.upload-icon {
  font-size: 32px;
}

.upload-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-secondary);
}

.upload-status {
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}

/* ─── Check Summary ─────────────────────── */

.check-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.check-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}

.check-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.check-stat-value {
  font-size: 18px;
  font-weight: 500;
}

.check-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
}

.check-badge.ok {
  background: #E8F5E9;
  color: #2E7D32;
}

.check-badge.warn {
  background: #FFF8E1;
  color: #F57F17;
}

.check-badge.error {
  background: #FFEBEE;
  color: #C62828;
}

/* ─── Check Table ───────────────────────── */

.check-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.check-table th {
  background: var(--bg);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.check-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.check-row-ok td {
  background: #FAFFF9;
}

.check-row-warn td {
  background: #FFFDF5;
}

.check-row-error td {
  background: #FFF8F8;
}

/* ─── Growth Visualization ───────────────── */

.growth-subtitle {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Highlight cards */
.growth-highlight {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.highlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
  transition: border-color 0.2s;
}

.highlight-card.up {
  border-left: 3px solid #27ae60;
}

.highlight-card.down {
  border-left: 3px solid #e74c3c;
}

.highlight-card.flat {
  border-left: 3px solid var(--border);
}

.highlight-label {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.highlight-value {
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 4px;
}

.highlight-diff {
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.highlight-diff.up { color: #27ae60; }
.highlight-diff.down { color: #e74c3c; }
.highlight-diff.flat { color: var(--text-secondary); }

.highlight-arrow {
  font-size: 9px;
}

.growth-no-data {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ─── Staff Display ──────────────────────── */

.staff-display {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--accent-light);
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── Todo ───────────────────────────────── */

/* ── Jr育成ツール ── */
.jr-training-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.jr-training-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 480px) {
  .jr-training-links { grid-template-columns: repeat(3, 1fr); }
}
.jr-training-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.jr-training-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.jr-training-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.jr-training-card-title {
  font-size: 13px;
  font-weight: 500;
}
.jr-training-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.todo-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.todo-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.todo-text-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.todo-text-input:focus {
  border-color: var(--accent);
}

.todo-add-btn {
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.todo-add-btn:hover { opacity: 0.85; }

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

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

.todo-item.done .todo-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.todo-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}

.todo-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.todo-title {
  font-size: 13px;
}

.todo-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.todo-delete-btn:hover {
  background: #FFEBEE;
  color: var(--danger);
}

.todo-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Radar chart */
.growth-radar-wrap {
  margin-bottom: 28px;
}

.growth-chart {
  height: 280px;
}

.radar-legend {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.radar-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}

.radar-legend-score {
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
}

.radar-legend-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── 1on1 Notes ─────────────────────────── */

.ono-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ono-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.ono-date {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.ono-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.ono-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}

.ono-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ─── Inventory ──────────────────────────── */

.inv-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.inv-brand-group {
  margin-bottom: 12px;
}

.inv-brand-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
  padding-left: 2px;
}

.inv-product-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.inv-product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  text-align: left;
}

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

.inv-product-row:hover,
.inv-product-row:active {
  background: rgba(0,0,0,0.03);
}

.inv-product-row.inv-stock-alert {
  background: #FFF8F8;
}

.inv-product-row.inv-stock-alert .inv-product-stock {
  color: #C0392B;
}

.inv-product-name {
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-primary);
}

.inv-product-stock {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  min-width: 32px;
  text-align: right;
}

/* Modal */
.inv-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
  overflow: hidden;
}

.inv-modal-inner {
  padding: 16px;
}

.inv-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.inv-modal-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.radar-legend-desc {
  font-size: 9px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Trend chart */
.growth-trend-wrap {
  margin-bottom: 28px;
}

.growth-trend-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.inv-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}

.inv-modal-stock {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.inv-modal-stock strong {
  font-size: 20px;
  color: var(--accent);
}

.inv-quick-btn {
  width: 100%;
  padding: 14px 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.inv-quick-btn:hover { opacity: 0.85; }
.inv-quick-btn:disabled { opacity: 0.5; }

.inv-csv-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
.inv-csv-btn:hover { opacity: 0.85; }

.inv-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.inv-summary-table th,
.inv-summary-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.inv-summary-table th {
  background: var(--accent-light);
  font-weight: 500;
  position: sticky;
  top: 0;
}
.inv-summary-table td:nth-child(3),
.inv-summary-table th:nth-child(3) {
  text-align: right;
}
.inv-summary-table tr.inv-summary-total {
  font-weight: 600;
  border-top: 2px solid var(--text-primary);
}

.inv-quick-sale {
  background: #E3F2FD;
  color: #1565C0;
}

.inv-quick-welfare {
  background: #FFF3E0;
  color: #E65100;
}

.inv-quick-purchase {
  background: #E8F5E9;
  color: #2E7D32;
}


/* History */
.inv-history {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.inv-history-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.inv-history-empty {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
}

.inv-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

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

.inv-history-date {
  color: var(--text-secondary);
  font-size: 11px;
  flex-shrink: 0;
}

.inv-history-type {
  flex-shrink: 0;
}

.inv-history-qty {
  font-weight: 500;
  flex-shrink: 0;
}

.inv-history-qty.plus { color: #2E7D32; }
.inv-history-qty.minus { color: #C0392B; }

.inv-history-who {
  color: var(--text-secondary);
  font-size: 11px;
  margin-left: auto;
}
.inv-history-undo {
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--danger);
  color: var(--danger);
  background: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 4px;
  flex-shrink: 0;
}
.inv-history-undo:hover { background: var(--danger); color: #fff; }
.inv-history-undo:disabled { opacity: 0.4; }

/* Count section inside modal */
.inv-count-section {
  margin-top: 14px;
  padding: 12px;
  background: var(--accent-light);
  border-radius: var(--radius);
}
.inv-count-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.inv-count-section .inv-count-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inv-count-section .inv-count-input {
  flex: 1;
  max-width: 120px;
}
.inv-count-status {
  font-size: 12px;
  margin-top: 6px;
}

/* Count list */
.inv-count-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-count-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inv-count-info {
  flex: 1;
  min-width: 0;
}

.inv-count-name {
  font-size: 13px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-count-expected {
  font-size: 11px;
  color: var(--text-secondary);
}

.inv-count-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.inv-count-input {
  width: 56px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  outline: none;
}

.inv-count-input:focus {
  border-color: var(--accent);
}

.inv-count-btn {
  padding: 6px 10px;
  font-size: 11px;
  font-family: inherit;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.inv-count-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Expense Items ──────────────────────── */

.expense-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.expense-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.expense-date {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.expense-detail {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.expense-amount {
  font-size: 13px;
  font-weight: 500;
}

/* ─── Trend ──────────────────────────────── */

.trend-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.trend-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.trend-tab.active,
.trend-tab:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Growth messages */
.growth-messages {
  margin-top: 4px;
}

.growth-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.7;
}

.growth-msg.positive {
  background: #F0FAF4;
  border: 1px solid #C8E6C9;
  color: #1B5E20;
}

.growth-msg.advice {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  color: #E65100;
}

.growth-msg.trend {
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  color: #2E7D32;
}

.growth-msg.neutral {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.growth-msg-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.growth-msg-text {
  flex: 1;
}

.trend-chart-wrap {
  height: 220px;
  margin-bottom: 16px;
}

.trend-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.trend-table th {
  background: var(--bg);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.trend-table th:first-child {
  text-align: left;
}

.trend-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.trend-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--accent);
}

.trend-table tr:last-child td {
  border-bottom: none;
}

.trend-change {
  font-size: 10px;
  margin-left: 4px;
}

.trend-change.up {
  color: #27ae60;
}

.trend-change.down {
  color: #C0392B;
}

/* ─── Responsive ─────────────────────────── */

@media (max-width: 600px) {
  .login-card {
    padding: 36px 24px;
  }
  .portal-main {
    padding: 24px 16px 60px;
  }
  .mvv-grid {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-value {
    font-size: 17px;
  }
  .ranking-item {
    padding: 10px 12px;
  }
  .rank-value {
    font-size: 14px;
  }
  .chart-wrap {
    height: 220px;
    padding: 12px 8px;
  }
  .check-summary-grid {
    grid-template-columns: 1fr;
  }
  .check-stat-value {
    font-size: 16px;
  }
  .check-table {
    font-size: 11px;
  }
  .check-table th,
  .check-table td {
    padding: 8px 6px;
  }
  .growth-highlight {
    grid-template-columns: repeat(2, 1fr);
  }
  .highlight-value {
    font-size: 15px;
  }
  .radar-legend {
    grid-template-columns: repeat(2, 1fr);
  }
  .radar-legend-item:last-child {
    grid-column: span 2;
    justify-self: center;
    max-width: calc(50% - 3px);
  }
  .growth-chart {
    height: 240px;
  }
  .growth-trend-tabs {
    flex-wrap: wrap;
  }
}

/* ─── Duties (役割分担) ──────────────────── */
.duties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.duty-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.duty-card-wide {
  grid-column: 1 / -1;
}
.duty-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.duty-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
}
.duty-select-sm {
  width: auto;
  min-width: 80px;
}
.duty-days-scroll {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.duty-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.duty-day-row:last-child {
  border-bottom: none;
}
.duty-day-date {
  font-size: 13px;
  min-width: 60px;
  color: var(--text-primary);
}

/* ─── Tasks (やることリスト) ────────────── */
.task-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-item.task-template {
  border-left: 3px solid var(--accent);
}
.task-item.done {
  opacity: 0.6;
}
.task-item.done .task-title {
  text-decoration: line-through;
}
.task-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.task-title {
  font-size: 14px;
}
.task-completed-date {
  font-size: 11px;
  color: #27ae60;
  white-space: nowrap;
}
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 26px;
}
.task-assign-select {
  flex: 1;
  max-width: 140px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-secondary);
}
.task-input-row {
  display: flex;
  gap: 8px;
}

@media (max-width: 600px) {
  .duties-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 月末処理 ── */
.me-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.me-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.me-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.me-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.me-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}
.me-badge-pending { background: #f0f0f0; color: var(--text-secondary); }
.me-badge-submitted { background: #FFF3E0; color: #E65100; }
.me-badge-verified { background: #E8F5E9; color: #2E7D32; }

.me-form { margin-top: 8px; }
.me-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.me-amount-input {
  flex: 1;
  padding: 8px 10px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  background: var(--bg);
}
.me-amount-display {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}
.me-file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}
.me-file-label.has-file {
  border-color: var(--accent);
  background: var(--accent-light);
}
.me-file-input { display: none; }
.me-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  margin-top: 8px;
  cursor: pointer;
}
.me-submit-btn {
  margin-top: 10px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.me-submit-btn:disabled { opacity: 0.5; }
.me-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.me-verify-btn {
  background: #E8F5E9;
  color: #2E7D32;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
}
.me-resubmit-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 6px;
  text-decoration: underline;
}
.me-inv-progress {
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.me-inv-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}
.me-inv-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.me-msg {
  font-size: 12px;
  margin-top: 6px;
}

/* ─── Expense Type Tabs ─────────────────── */
.expense-type-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.expense-type-btn {
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.expense-type-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Welfare Multi-item ────────────────── */
.welfare-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.welfare-remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.btn-text:hover { text-decoration: underline; }

/* ─── Target Setting ────────────────────── */
.target-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.target-label {
  font-size: 13px;
  min-width: 100px;
}
.target-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.target-input-wrap span {
  font-size: 13px;
  color: var(--text-secondary);
}
.target-input-wrap .input-number {
  width: 120px;
  text-align: right;
}

/* ─── Admin Toolbar ─────────────────────── */
.admin-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 8px;
}
@media (min-width: 600px) {
  .admin-toolbar {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
  }
}
.admin-month-picker {
  padding: 8px 0 4px;
  flex-shrink: 0;
}
@media (min-width: 600px) {
  .admin-month-picker { padding: 0 0 6px; }
}

/* ─── Admin Tabs ────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  position: relative;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
@media (min-width: 600px) {
  .admin-tab { font-size: 13px; padding: 10px 16px; }
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab-external {
  text-decoration: none;
  color: var(--accent);
  opacity: 0.8;
}
.admin-tab-external:hover { opacity: 1; }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* ─── Dashboard Layout ──────────────────── */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 700px) {
  .dash-two-col { grid-template-columns: 1fr 1fr; gap: 16px; }
}
.dash-kpi-grid-compact {
  grid-template-columns: repeat(2, 1fr) !important;
}
@media (min-width: 480px) {
  .dash-kpi-grid-compact { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ─── Forecast ──────────────────────────── */
.forecast-rate-ok { color: #27ae60; font-weight: 500; }
.forecast-rate-warn { color: #e67e22; font-weight: 500; }
.forecast-rate-ng { color: var(--danger); font-weight: 500; }
.dash-table-total {
  background: var(--bg);
  border-top: 2px solid var(--border);
}
.forecast-progress {
  margin-top: 12px;
  background: var(--border);
  border-radius: 4px;
  height: 20px;
  position: relative;
  overflow: hidden;
}
.forecast-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}
.forecast-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  mix-blend-mode: difference;
  color: #fff;
}

/* ─── Dashboard ─────────────────────────── */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) {
  .dash-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
.dash-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.dash-kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.dash-kpi-value {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}
.dash-kpi-change {
  font-size: 11px;
  margin-top: 4px;
  color: var(--text-secondary);
}
.dash-kpi-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dash-change-up { color: #27ae60; }
.dash-change-down { color: var(--danger); }

.dash-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.dash-table th, .dash-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dash-table th {
  background: var(--bg);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 11px;
  position: sticky;
  top: 0;
}
.dash-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dash-table tbody tr:hover {
  background: var(--accent-light);
}

.dash-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dash-dot-ok { background: #27ae60; }
.dash-dot-warn { background: #f39c12; }
.dash-dot-none { background: var(--border); }

.dash-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.dash-download-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) {
  .dash-download-grid { grid-template-columns: repeat(4, 1fr); }
}
.dash-dl-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}
.dash-dl-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}
.dash-dl-all {
  grid-column: 1 / -1;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
}
.dash-dl-all:hover {
  opacity: 0.9;
}

/* ══ お知らせバナー ══ */
.announcement-banner {
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
}
.announcement-header {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.announcement-unread-badge {
  background: #C0392B;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.announcement-item {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.announcement-item:last-child { margin-bottom: 0; }
.announcement-item.unread {
  background: #FFF8E1;
  border: 1px solid #F0E4C0;
}
.announcement-item.read {
  background: var(--bg);
  border: 1px solid var(--border);
  opacity: 0.8;
}
.announcement-item.important .announcement-title {
  font-weight: 500;
}
.announcement-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.78rem;
}
.announcement-priority {
  background: #C0392B;
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
}
.announcement-date {
  color: var(--text-secondary);
}
.announcement-target {
  color: var(--accent);
  font-size: 0.72rem;
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: 4px;
}
.announcement-title {
  font-size: 0.9rem;
  color: var(--text-primary);
}
.announcement-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: pre-line;
}

/* 管理画面お知らせ管理 */
.ann-form { display: flex; flex-direction: column; gap: 8px; }
.ann-form input, .ann-form select, .ann-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
}
.ann-form textarea { min-height: 80px; resize: vertical; }
.ann-list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.ann-list-item:last-child { border-bottom: none; }
