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

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

:root {
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --surface2:    #f1f5f9;
  --border:      #e2e8f0;
  --accent:      #4f46e5;
  --accent-lt:   #eef2ff;
  --accent2:     #7c3aed;
  --success:     #059669;
  --success-lt:  #ecfdf5;
  --danger:      #dc2626;
  --danger-lt:   #fef2f2;
  --warn:        #d97706;
  --warn-lt:     #fffbeb;
  --text:        #0f172a;
  --text-2:      #475569;
  --text-3:      #94a3b8;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 16px rgba(0,0,0,.08);
  --radius:      12px;
  --radius-sm:   8px;
}

html, body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- LAYOUT ---- */
.app-wrap {
  display: grid;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ---- HEADER / NAV ---- */
.top-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.nav-logo {
  font-weight: 700; font-size: 15px;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
  margin-right: 24px; white-space: nowrap;
}
.nav-logo::before { content: '🏡'; font-size: 18px; }

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-2);
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-link:hover    { background: var(--surface2); color: var(--text); }
.nav-link.active   { background: var(--accent-lt); color: var(--accent); }

.nav-right {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto;
}
.nav-user {
  font-size: 13px; color: var(--text-2); font-weight: 500;
}
.btn-logout {
  font-size: 12px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 99px;
  background: none; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-logout:hover { background: var(--danger-lt); color: var(--danger); border-color: var(--danger); }

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.card-subtitle { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.required::after { content: ' *'; color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea { resize: vertical; min-height: 120px; line-height: 1.7; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: all .15s;
  white-space: nowrap; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #4338ca; }
.btn-secondary {
  background: var(--surface2); color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); color: var(--text); }
.btn-success {
  background: var(--success); color: #fff;
}
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-danger {
  background: var(--danger); color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-outline {
  background: none; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover:not(:disabled) { background: var(--accent-lt); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 6px 10px; }

/* ---- BADGES / CHIPS ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-generated { background: var(--accent-lt); color: var(--accent); }
.badge-sent      { background: var(--success-lt); color: var(--success); }
.badge-airbnb         { background: #ffe4e6; color: #be123c; }
.badge-booking        { background: #dbeafe; color: #1d4ed8; }
.badge-rakuten_travel { background: #fff1f0; color: #c4320a; }
.badge-jalan          { background: #fef3c7; color: #b45309; }
.badge-other          { background: var(--surface2); color: var(--text-2); }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
}
th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--text-3);
  border-bottom: 2px solid var(--border);
  white-space: nowrap; letter-spacing: .05em; text-transform: uppercase;
}
td {
  padding: 12px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.td-link { cursor: pointer; }
.td-link:hover { color: var(--accent); text-decoration: underline; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 16px;
}
.alert-error   { background: var(--danger-lt); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-lt); color: var(--success); border: 1px solid #a7f3d0; }
.alert-info    { background: var(--accent-lt); color: var(--accent); border: 1px solid #c7d2fe; }
.alert-warn    { background: var(--warn-lt); color: var(--warn); border: 1px solid #fde68a; }

/* ---- PAGE TITLE ---- */
.page-header { margin-bottom: 28px; }
.page-title {
  font-size: 22px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.page-desc { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* ---- INDEX: 2-col layout ---- */
.index-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .index-grid { grid-template-columns: 1fr; }
  .form-row   { grid-template-columns: 1fr; }
}

/* ---- REPLY AREA ---- */
.reply-area {
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--accent-lt);
  margin-top: 20px;
  display: none;
}
.reply-area.visible { display: block; }
.reply-label {
  font-size: 11px; font-weight: 700; color: var(--accent);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px;
}
.reply-text {
  width: 100%; min-height: 180px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.8; font-family: inherit;
  background: var(--surface); color: var(--text); resize: vertical;
}
.reply-actions {
  display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap;
}

/* ---- RECENT LIST (sidebar) ---- */
.recent-item {
  padding: 14px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--surface2); margin: 0 -12px; padding: 14px 12px; border-radius: var(--radius-sm); }
.recent-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  flex-wrap: wrap;
}
.recent-preview { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.recent-name { font-size: 12px; font-weight: 600; color: var(--text); }
.recent-date { font-size: 11px; color: var(--text-3); }

/* ---- HISTORY FILTERS ---- */
.filter-bar {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 20px; align-items: end;
}
.filter-bar .btn { height: 40px; }
input[type="date"] {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  font-family: inherit; color: var(--text);
  background: var(--surface); outline: none; width: 100%;
}
input[type="date"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 680px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-3); line-height: 1;
  padding: 4px; border-radius: 4px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ---- DETAIL VIEW ---- */
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 16px; background: var(--surface2);
  border-radius: var(--radius-sm); margin-bottom: 20px;
}
.detail-meta-item { font-size: 13px; }
.detail-meta-label { font-size: 11px; font-weight: 700; color: var(--text-3); display: block; margin-bottom: 2px; }
.detail-block { margin-bottom: 20px; }
.detail-block-title {
  font-size: 12px; font-weight: 700; color: var(--text-3);
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.detail-text {
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 13px; line-height: 1.8;
  white-space: pre-wrap; color: var(--text);
  border: 1px solid var(--border);
}

/* ---- SPINNER ---- */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-dark {
  border-color: rgba(79,70,229,.2);
  border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo h1 {
  font-size: 22px; font-weight: 800; color: var(--accent);
}
.login-logo p { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* ---- ADMIN ---- */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 768px) { .admin-grid { grid-template-columns: 1fr; } }
.user-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.user-list-item:last-child { border-bottom: none; }
.user-info { flex: 1; }
.user-name { font-size: 14px; font-weight: 600; }
.user-email { font-size: 12px; color: var(--text-2); }
.user-actions { display: flex; gap: 6px; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-3);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state-text { font-size: 14px; }

/* ---- REVIEW / APPROVAL ---- */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  border-radius: 99px; padding: 1px 8px;
  font-size: 11px; font-weight: 800;
  min-width: 18px; margin-left: 4px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
.nav-link.review-link {
  background: rgba(220, 38, 38, .08);
  color: var(--danger);
  font-weight: 700;
}
.nav-link.review-link:hover { background: rgba(220, 38, 38, .15); color: var(--danger); }

.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

.reject-comment {
  background: var(--danger-lt); border: 1px solid #fecaca;
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 13px; line-height: 1.7; color: #991b1b;
}
.reject-comment-label {
  font-size: 11px; font-weight: 700; color: var(--danger);
  margin-bottom: 4px; letter-spacing: .08em; text-transform: uppercase;
}

/* ---- UTILS ---- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-2); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; display: inline-block; }
