:root {
  --yellow: #FFD94A;
  --yellow-light: #FFF3B0;
  --yellow-dark: #E6B800;
  --dark: #2D2A1E;
  --body-bg: #FEFAE8;
  --shadow: rgba(45, 42, 30, 0.12);
  --white: #ffffff;
  --muted: #666;
  --border: rgba(230, 184, 0, 0.35);
  --sidebar-w: 240px;
}

* { 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); }

/* ----- 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 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.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 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  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 20px 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: 32px 40px 48px;
  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: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

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

.summary-card,
.stat-card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  border: 2px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
}

.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: 16px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 4px;
}

.table-wrap {
  background: var(--white);
  border-radius: 16px;
  border: 2px solid var(--border);
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow);
}

.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: var(--body-bg);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.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; }
}
