:root {
  --yellow: #FFBE08;
  --yellow-light: rgba(255, 190, 8, 0.15);
  --yellow-dark: #FFD94A;
  --dark: #2A2312;
  --darker: #1E1A0D;
  --body-bg: #2A2312;
  --card-bg: #1E1A0D;
  --shadow: rgba(0, 0, 0, 0.4);
  --white: #fbfcfc;
  --muted: rgba(251, 252, 252, 0.5);
  --border: rgba(255, 190, 8, 0.15);
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 62px;
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--body-bg);
  color: var(--dark);
  min-height: 100vh;
}

a { color: var(--yellow-dark); font-weight: 700; }

/* ----- Login ----- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 20px 50px var(--shadow);
  border: 2px solid var(--border);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-decoration: none;
  color: var(--dark);
}

.login-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--yellow);
  border-radius: 8px;
  box-shadow: 2px 4px 0 var(--yellow-dark);
}

.login-logo-text {
  font-family: 'Nunito', sans-serif;
  font-size: 28px;
  font-weight: 900;
}

.login-logo-text span { color: var(--yellow-dark); }

.login-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.login-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--body-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--yellow-dark);
  box-shadow: 0 0 0 3px rgba(255, 217, 74, 0.35);
}

.form-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--body-bg);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--yellow-dark);
  box-shadow: 0 0 0 3px rgba(255, 217, 74, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 36px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--dark);
  color: var(--white);
  box-shadow: 0 4px 0 #111;
  margin-top: 8px;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #111;
}

.btn-secondary {
  height: 36px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
  box-sizing: border-box;
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #222;
}

.btn-ghost.btn-ghost-strong {
  width: auto;
  color: #2d2400;
  font-weight: 700;
  border: 1.5px solid rgba(0, 0, 0, 0.18);
}

.btn-ghost.btn-ghost-strong:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.3);
  color: #000;
}

.btn-ghost.btn-ghost-success {
  width: auto;
  color: #2e7d32;
  font-weight: 700;
  border: 1.5px solid #2e7d32;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost.btn-ghost-success:hover {
  background: rgba(46, 125, 50, 0.08);
  border-color: #1b5e20;
  color: #1b5e20;
}

.form-error {
  margin-top: 14px;
  font-size: 13px;
  color: #c0392b;
  min-height: 1.2em;
}

.form-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.form-footer a {
  text-decoration: none;
}

.form-footer a:hover { text-decoration: underline; }

.back-home {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
}

.back-home a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.back-home a:hover { color: var(--dark); }

.site-legal-links {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
}

.site-legal-links a {
  color: rgba(251, 252, 252, 0.55);
  text-decoration: none;
  font-weight: 700;
}

.site-legal-links a:hover {
  color: var(--yellow-dark);
  text-decoration: underline;
}

.site-legal-links span {
  margin: 0 8px;
  color: rgba(251, 252, 252, 0.3);
}

/* ----- Dashboard layout ----- */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar > a {
  display: block;
  margin-bottom: 8px;
  padding-left: 14px;
}

.sidebar a img {
  max-width: 120px;
  height: auto;
  display: block;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  text-decoration: none;
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--yellow);
  border-radius: 6px;
  box-shadow: 2px 3px 0 var(--yellow-dark);
}

.sidebar-brand-text {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 900;
}

.sidebar-brand-text span { color: var(--yellow); }

.sidebar-tenant {
  padding: 0 20px 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
  padding: 8px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 217, 74, 0.15);
  color: var(--yellow);
}

.sidebar-nav a.active { font-weight: 800; }

.sidebar-footer {
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn-logout {
  width: 100%;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}

.sidebar-footer .btn-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 28px 40px;
  min-width: 0;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 6px;
}

.page-header p {
  font-size: 14px;
  color: var(--muted);
}

.section-block {
  margin-bottom: 40px;
  scroll-margin-top: 24px;
}

.section-block h2 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #EFE8D0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.summary-card,
.stat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid #ECE5D0;
  box-shadow: 0 1px 3px rgba(45, 42, 30, 0.06);
}

.summary-label,
.stat-card-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-value,
.stat-card-value {
  font-family: 'Nunito', sans-serif;
  font-size: 36px;
  font-weight: 900;
  color: var(--dark);
  line-height: 1;
}

.stat-card-value span {
  font-size: 15px;
  font-weight: 600;
  color: #B0A88E;
  margin-left: 5px;
}

.table-wrap {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid #ECE5D0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(45, 42, 30, 0.06);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #f0ebe0;
}

.data-table th {
  background: #FBF7E8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid #EFE8D0;
}

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

.data-table td.url-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #444;
}

.data-table td.content-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table td.confirm-status-cell {
  min-width: 160px;
  max-width: 240px;
  font-size: 13px;
  line-height: 1.5;
  vertical-align: top;
}

.confirm-entry + .confirm-entry {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e8e0c8;
}

.confirm-muted {
  color: #aaa;
}

.confirm-pending {
  color: #b45309;
  font-weight: 700;
}

.confirm-ratio-btn {
  border: none;
  background: var(--yellow-light);
  color: var(--dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--yellow-dark);
  transition: transform 0.15s, box-shadow 0.15s;
}

.confirm-ratio-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--yellow-dark);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(45, 42, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.hidden {
  display: none;
}

.confirm-modal,
.modal-box {
  background: var(--white);
  border-radius: 20px;
  border: 2px solid var(--border);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px var(--shadow);
}

.confirm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 2px solid var(--border);
}

.confirm-modal-header h3 {
  font-size: 18px;
  font-weight: 900;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
}

.confirm-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.confirm-modal-section + .confirm-modal-section {
  margin-top: 24px;
}

.confirm-modal-section h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--dark);
}

.confirm-modal-list {
  list-style: none;
  font-size: 14px;
  line-height: 1.7;
}

.confirm-modal-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f0ebe0;
}

.confirm-modal-list li:last-child {
  border-bottom: none;
}

.confirm-modal-empty {
  font-size: 13px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-admin { background: var(--yellow-light); color: var(--dark); }
.badge-member { background: #eee; color: #555; }
.badge-active { background: #d4edda; color: #155724; }

.btn-sm {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  margin-right: 6px;
  transition: opacity 0.2s;
}

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

.btn-sm-view {
  background: var(--yellow);
  color: var(--dark);
}

.btn-sm-danger {
  background: #fee;
  color: #c0392b;
}

.table-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.settings-panel {
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  border: 2px solid var(--border);
  max-width: 520px;
}

.settings-panel p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 12px;
}

.settings-panel strong { color: var(--dark); }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

.loading-overlay.hidden,
.hidden { display: none !important; }

@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 16px;
  }

  .sidebar-brand { border: none; margin: 0; padding: 0 12px 0 0; }
  .sidebar-tenant { display: none; }
  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    flex: 1;
  }
  .sidebar-nav a { padding: 8px 12px; font-size: 13px; }
  .sidebar-footer { border: none; padding: 0; }
  .sidebar-footer .btn-logout { width: auto; padding: 8px 16px; }

  .dashboard-layout { flex-direction: column; }
  .main { margin-left: 0; padding: 24px 20px; }
  .stats-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
}

/* ===== Dashboard UI/UX 刷新 ===== */
@keyframes pepeFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pepeCount {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.stats-grid .summary-card,
.stats-grid .stat-card {
  animation: pepeFadeUp 0.5s cubic-bezier(.22,1,.36,1) both;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stats-grid > *:nth-child(1) { animation-delay: 0.05s; }
.stats-grid > *:nth-child(2) { animation-delay: 0.12s; }
.stats-grid > *:nth-child(3) { animation-delay: 0.19s; }
.stats-grid > *:nth-child(4) { animation-delay: 0.26s; }

.stats-grid .summary-card:hover,
.stats-grid .stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(45, 42, 30, 0.10);
  border-color: var(--yellow-dark);
}

.summary-value,
.stat-card-value {
  animation: pepeCount 0.6s cubic-bezier(.22,1,.36,1) both;
  animation-delay: 0.3s;
}

.section-block {
  animation: pepeFadeUp 0.5s cubic-bezier(.22,1,.36,1) both;
}

.sidebar-nav a {
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}
.sidebar-nav a:hover {
  padding-left: 18px;
}

.data-table tbody tr {
  transition: background 0.14s ease;
}
.data-table tbody tr:hover {
  background: #FCF8EA;
}

.sidebar-nav a {
  white-space: nowrap;
}

.tag-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.tag-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex: 0 0 auto;
}

.tag-color-swatch:hover {
  transform: scale(1.05);
}

.tag-color-swatch-selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  transform: scale(1.1);
}

.section-desc {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 18px;
}

#feature-flags-list {
  background: var(--white);
  border: 1px solid #ECE5D0;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}

.feature-flag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #EAEAEA;
}

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

.feature-flag-info {
  flex: 1;
}

.feature-flag-label {
  font-size: 15px;
  font-weight: 600;
  color: #5d4e00;
}

.feature-flag-desc {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 16px;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: 0.3s;
}

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

input:checked + .toggle-slider {
  background: #FFD94A;
}

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

#save-feature-flags-btn {
  margin-top: 4px;
}

#feature-flags-status {
  font-size: 13px;
  margin-top: 10px;
}

/* ===== ダークテーマ刷新 ===== */
body {
  background: var(--body-bg);
  color: var(--white);
}

.dashboard-layout {
  background: var(--body-bg);
}

.sidebar {
  background: var(--darker);
  border-right: 1px solid var(--border);
}

/* サイドバー上部：ユーザープロフィール */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-user-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFBE08, #e6a500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #2A2312;
  flex-shrink: 0;
}
.sidebar-user-avatar::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #4ade80;
  border-radius: 50%;
  border: 2px solid var(--darker);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: rgba(255, 190, 8, 0.6);
  margin-top: 1px;
}

.sidebar-brand-bottom {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 190, 8, 0.3);
  letter-spacing: 1px;
}

.sidebar-nav a {
  color: rgba(251, 252, 252, 0.5);
  border-radius: 10px;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 190, 8, 0.12);
  color: var(--yellow);
}

.page-header h1 { color: var(--white); }
.page-header p { color: var(--muted); }

.section-block h2 {
  color: var(--white);
  border-bottom: 1px solid var(--border);
}

.summary-card,
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: none;
}
.summary-label,
.stat-card-label { color: var(--muted); }
.summary-value,
.stat-card-value { color: var(--white); }

.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: none;
}
.data-table th {
  background: rgba(255, 190, 8, 0.05);
  color: rgba(255, 190, 8, 0.6);
  border-bottom: 1px solid var(--border);
}
.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(255, 190, 8, 0.08);
  color: var(--white);
}
.data-table tbody tr:hover {
  background: rgba(255, 190, 8, 0.04);
}

.settings-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
}
.settings-panel p { color: var(--muted); }
.settings-panel strong { color: var(--white); }

#feature-flags-list {
  background: var(--card-bg);
  border: 1px solid var(--border);
}
.feature-flag-item {
  border-bottom: 1px solid var(--border);
}
.feature-flag-label { color: var(--white); }
.feature-flag-desc { color: var(--muted); }

.confirm-modal,
.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--white);
}
.confirm-modal-header {
  border-bottom: 1px solid var(--border);
}
.confirm-modal-header h3 { color: var(--white); }
.confirm-modal-list li {
  border-bottom: 1px solid var(--border);
  color: var(--white);
}

.loading-overlay {
  background: var(--body-bg);
  color: var(--muted);
}

input, select, textarea {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: var(--border) !important;
  color: var(--white) !important;
}
input::placeholder, textarea::placeholder {
  color: rgba(251, 252, 252, 0.3) !important;
}

.section-desc { color: var(--muted); }

.btn-primary {
  background: var(--yellow);
  color: #2A2312;
  box-shadow: 0 4px 0 #e6a500;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 0 #e6a500;
}

/* ===== ログインカード（白背景）— ダークテーマ全局スタイルの上書き ===== */
.login-card .login-title {
  color: var(--dark);
}

.login-card .login-sub {
  color: #5c5344;
}

.login-card .form-group label,
.login-card label {
  color: var(--dark);
}

.login-card input,
.login-card select,
.login-card textarea,
.login-card .form-input {
  color: var(--dark) !important;
  background: #fff !important;
  border-color: rgba(42, 35, 18, 0.15) !important;
}

.login-card input::placeholder,
.login-card textarea::placeholder,
.login-card .form-input::placeholder {
  color: rgba(42, 35, 18, 0.38) !important;
}

.login-card input:focus,
.login-card textarea:focus,
.login-card .form-input:focus {
  border-color: var(--yellow-dark) !important;
  box-shadow: 0 0 0 3px rgba(255, 217, 74, 0.35) !important;
}

.login-card .form-footer {
  color: #6b6355;
}

.login-card .form-footer a {
  color: #5d4e00;
}

/* ===== サイドバー折りたたみ（最終版・Linear方式） ===== */

.sidebar { transition: width 0.22s cubic-bezier(0.4,0,0.2,1), padding 0.22s cubic-bezier(0.4,0,0.2,1); }
.main { transition: margin-left 0.22s cubic-bezier(0.4,0,0.2,1); }

/* トグルボタン：サイドバー右端の境界線上に配置 */
#sidebarToggle {
  position: absolute;
  top: 70px;
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--dark);
  border: 1px solid var(--border);
  color: var(--yellow);
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  padding: 0;
  transition: background 0.15s ease;
}
#sidebarToggle:hover { background: rgba(255,190,8,0.18); }

/* ナビアイコンのサイズ統一 */
.sidebar-nav a i { font-size: 20px; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-footer .btn-logout { display: flex; align-items: center; justify-content: center; gap: 8px; }
.sidebar-footer .btn-logout i { font-size: 18px; }

/* === 折りたたみ状態 === */
.sidebar.collapsed { width: var(--sidebar-collapsed-w); padding: 24px 0; }
.main.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed-w);
  padding: 24px 32px 40px;
}

/* テキストを全部隠す */
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-brand-bottom,
.sidebar.collapsed .btn-logout span { display: none; }

/* アバターを中央に収める */
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 4px 0 20px; gap: 0; }
.sidebar.collapsed .sidebar-user-avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }

/* ナビアイコンを中央揃え（スクロールバーなしで全項目収まる） */
.sidebar.collapsed .sidebar-nav { padding: 8px 0; overflow: visible; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 11px 0; gap: 0; }
.sidebar.collapsed .sidebar-nav a i { width: auto; }

/* フッターのログアウトをアイコンのみに */
.sidebar.collapsed .sidebar-footer { padding: 16px 12px 0; }
.sidebar.collapsed .btn-logout { padding: 11px 0; }

/* ホバーでツールチップ表示 */
.sidebar.collapsed .sidebar-nav a { position: relative; }
.sidebar.collapsed .sidebar-nav a:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--darker);
  color: var(--white);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
}

/* ===== KPIストリップ（ダッシュボード上部） ===== */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px 18px;
}
.kpi-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.kpi-card-head i {
  font-size: 15px;
  color: var(--yellow);
}
.kpi-card-head span {
  font-size: 12px;
  color: rgba(251, 252, 252, 0.5);
}
.kpi-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}
.kpi-card-value span {
  font-size: 13px;
  font-weight: 500;
  color: rgba(251, 252, 252, 0.4);
  margin-left: 4px;
}
@media (max-width: 900px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 掲示板カード（ダッシュボード上部・プレビュー） ===== */
.board-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.board-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.board-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.board-card-title > i {
  font-size: 16px;
  color: var(--yellow);
}
.board-card-title > span:nth-child(2) {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
}
.board-unread-badge {
  font-size: 11px;
  background: rgba(255, 190, 8, 0.15);
  color: var(--yellow);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.board-seeall {
  font-size: 11px;
  color: var(--yellow);
  cursor: pointer;
}
.board-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.board-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border-left: 3px solid rgba(251, 252, 252, 0.1);
  cursor: pointer;
}
.board-item-pinned {
  background: rgba(255, 190, 8, 0.06);
  border-left: 3px solid var(--yellow);
}
.board-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(251, 252, 252, 0.4);
  font-size: 14px;
}
.board-item-icon-pinned {
  background: rgba(255, 190, 8, 0.15);
  color: var(--yellow);
}
.board-item-body {
  flex: 1;
  min-width: 0;
}
.board-item-titlerow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.board-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--white);
}
.board-item-unread {
  font-size: 10px;
  background: rgba(255, 190, 8, 0.2);
  color: var(--yellow);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.board-item-excerpt {
  font-size: 11px;
  color: rgba(251, 252, 252, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-item-meta {
  font-size: 10px;
  color: rgba(251, 252, 252, 0.3);
  margin-top: 4px;
}

/* ===== グリーティング ===== */
.greeting-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.greeting-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.3px;
}
.greeting-date {
  font-size: 12px;
  color: rgba(251, 252, 252, 0.3);
}

/* ===== 使用状況トグル（管理者のみ） ===== */
.kpi-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 190, 8, 0.55);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0 12px;
  font-family: inherit;
  transition: color 0.15s;
}
.kpi-toggle-btn i { font-size: 14px; transition: transform 0.2s; }
.kpi-toggle-btn:hover,
.kpi-toggle-open { color: var(--yellow); }

/* ===== ダッシュボードホーム 3カラム ===== */
.home-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}
.home-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.home-main .section-block { margin: 0; }
.home-side { display: flex; flex-direction: column; gap: 10px; }

.side-widget {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px;
}
.side-widget-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.side-widget-head i { font-size: 15px; color: var(--yellow); }
.side-widget-head span { font-size: 12.5px; font-weight: 700; color: var(--white); }
.side-widget-body { display: flex; flex-direction: column; gap: 7px; }
.side-empty { font-size: 11.5px; color: rgba(251,252,252,0.35); margin: 0; }

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

/* ===== サイドウィジェット：ポータル ===== */
.side-portal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}
.side-portal-item:hover { background: rgba(255,190,8,0.08); }
.side-portal-item i { font-size: 13px; color: rgba(255,190,8,0.6); flex-shrink: 0; }
.side-portal-item span {
  font-size: 11.5px;
  color: rgba(251,252,252,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-more { font-size: 10.5px; color: rgba(251,252,252,0.3); margin: 4px 0 0; }

/* ===== サイドウィジェット：今日の予定（デザイン修正） ===== */
.side-schedule-item {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
}
.side-schedule-bar {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  min-height: 32px;
  background: var(--yellow);
}
.side-schedule-body { min-width: 0; }
.side-schedule-time {
  font-size: 10px;
  color: rgba(251,252,252,0.45);
  margin-bottom: 3px;
}
.side-schedule-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== サイドウィジェット：使用状況 2×2 ===== */
.side-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.side-kpi-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,190,8,0.08);
  border-radius: 9px;
  padding: 10px 12px;
}
.side-kpi-card-label {
  font-size: 10px;
  color: rgba(251,252,252,0.4);
  margin-bottom: 6px;
}
.side-kpi-card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}
.kpi-green { color: #4ade80; }
.kpi-yellow { color: var(--yellow); }
.kpi-red { color: #f87171; }

/* ===== home-main内のsection-blockマージン強制リセット ===== */
.home-main > .section-block {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

/* ===== greetingの日付を右端に固定（2/3幅に合わせる） ===== */
.greeting-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  max-width: calc(100% * 2 / 3 + 8px); /* home-gridの2/3幅に合わせる */
  padding-right: 8px;
}

/* ===== home-main内の付箋一覧（コンパクト版） ===== */
.home-notes { margin: 0 !important; }
.home-notes .data-table th,
.home-notes .data-table td { font-size: 12px; padding: 10px 12px; }

/* ===== 付箋一覧テーブルのコンパクト化（中身のみ・レイアウト不変） ===== */
.home-main .data-table th,
.home-main .data-table td {
  font-size: 12px;
  padding: 9px 12px;
}
.home-main .data-table td:first-child {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-main .data-table .btn-sm,
.home-main .data-table button {
  font-size: 11px;
  padding: 5px 10px;
}

/* ===== 掲示板：緊急度別スタイル ===== */
.board-item-urgent {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
}
.board-item-important {
  background: rgba(255, 190, 8, 0.08);
  border-left: 3px solid var(--yellow);
}
.board-item-icon-urgent {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}
.board-item-icon-important {
  background: rgba(255, 190, 8, 0.18);
  color: var(--yellow);
}
.board-item-urgent-badge {
  font-size: 10px;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.board-item-important-badge {
  font-size: 10px;
  background: rgba(255, 190, 8, 0.2);
  color: var(--yellow);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

@keyframes boardPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,190,8,0.4); }
  70% { box-shadow: 0 0 0 8px rgba(255,190,8,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,190,8,0); }
}
.board-pulse {
  animation: boardPulse 1.2s ease-out 1;
}

.board-post-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow);
  color: #1A160B;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.board-post-btn:hover { background: var(--yellow-dark); }

/* ===== 掲示板投稿モーダル レイアウト修正 ===== */
#boardPostModal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
}
#boardPostModal .modal-body > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#boardPostModal .form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(251,252,252,0.7);
  display: block;
}
#boardPostModal .form-control {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,190,8,0.2);
  border-radius: 8px;
  color: var(--white);
  font-size: 13px;
  padding: 10px 12px;
  font-family: inherit;
  box-sizing: border-box;
}
#boardPostModal .form-control:focus {
  outline: none;
  border-color: var(--yellow);
}
#boardPostModal textarea.form-control {
  resize: vertical;
  min-height: 120px;
}
#boardPostModal select.form-control {
  cursor: pointer;
}
#boardPostModal .modal-body > div:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
#boardPostModal input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--yellow);
  flex-shrink: 0;
  cursor: pointer;
}
#boardPostModal .modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
#boardPostModal .btn-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(251,252,252,0.7);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
#boardPostModal .btn-primary {
  background: var(--yellow);
  border: none;
  color: #1A160B;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}
#boardPostModal .modal-box {
  background: var(--darker);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  overflow: hidden;
}
#boardPostModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
#boardPostModal .modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}
#boardPostModal .modal-close {
  background: none;
  border: none;
  color: rgba(251,252,252,0.5);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  display: flex;
  align-items: center;
}

/* ===== 掲示板投稿モーダル 高さ・スクロール修正 ===== */
#boardPostModal.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#boardPostModal .modal-box {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#boardPostModal .modal-body {
  overflow-y: auto;
  flex: 1;
}
#boardPostModal textarea.form-control {
  min-height: 80px;
  max-height: 160px;
}

/* ===== 掲示板投稿モーダル：ボタン修正・Quill調整 ===== */
#boardPostModal .modal-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
#boardPostModal .btn-primary {
  width: auto;
  min-width: 120px;
}
#boardPostModal .ql-toolbar {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,190,8,0.2) !important;
  border-bottom: none !important;
  border-radius: 8px 8px 0 0;
}
#boardPostModal .ql-container {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,190,8,0.2) !important;
  border-radius: 0 0 8px 8px;
  color: var(--white);
  font-size: 13px;
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
}
#boardPostModal .ql-editor {
  color: var(--white);
  min-height: 120px;
}
#boardPostModal .ql-editor.ql-blank::before {
  color: rgba(251,252,252,0.3);
  font-style: normal;
}
#boardPostModal .ql-stroke { stroke: rgba(251,252,252,0.6) !important; }
#boardPostModal .ql-fill { fill: rgba(251,252,252,0.6) !important; }
#boardPostModal .ql-picker-label { color: rgba(251,252,252,0.6) !important; }

#boardPriorityInput option {
  background: #1E1A0D;
  color: #fbfcfc;
}
