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

* { box-sizing: border-box; }
html, body {
  font-family: 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  margin: 0; padding: 0;
  background: #fffbeb;
  color: #1c1917;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #fcd34d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #fbbf24; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  font-weight: 500; font-size: 14px; font-family: inherit;
  cursor: pointer; border: 1px solid transparent; transition: all 0.15s;
}
.btn-primary { background: #d97706; color: white; }
.btn-primary:hover { background: #b45309; }
.btn-secondary { background: white; color: #44403c; border-color: #e7e5e4; }
.btn-secondary:hover { background: #f5f5f4; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 3px 10px; font-size: 13px; }

.card {
  background: white; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(28,25,23,0.05);
  border: 1px solid #e7e5e4;
}

.input, .select, .textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid #d6d3d1; border-radius: 8px;
  font-family: inherit; font-size: 14px; background: white; color: #1c1917;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,0.12);
}
.textarea { resize: vertical; min-height: 80px; }

.tab {
  padding: 10px 18px; font-weight: 500; color: #78716c;
  border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
  background: none; border-left: none; border-right: none; border-top: none; font-family: inherit; font-size: 14px;
}
.tab:hover { color: #b45309; background: #fffbeb; }
.tab.active { color: #d97706; border-bottom-color: #d97706; background: #fef3c7; }

table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
  background: #fffbeb; color: #b45309; font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 2px solid #fcd34d; font-size: 13px;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.data tbody td { padding: 9px 12px; border-bottom: 1px solid #f5f5f4; font-size: 14px; vertical-align: top; }
table.data tbody tr:hover { background: #fffbeb; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #e7e5e4; color: #57534e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(28,25,23,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: white; border-radius: 14px; max-width: 720px; width: 90vw; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,0.2); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid #e7e5e4; display:flex; justify-content:space-between; align-items:center; }
.modal-body   { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid #e7e5e4; display:flex; justify-content:flex-end; gap:8px; }

.field-label { display: block; font-size: 13px; font-weight: 500; color: #57534e; margin-bottom: 4px; }

.stat-card { background: white; border-radius: 14px; padding: 18px; border: 1px solid #e7e5e4; display: flex; gap: 14px; align-items: center; transition: transform 0.15s, box-shadow 0.15s; text-decoration: none; color: inherit; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(28,25,23,0.08); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; background: #fef3c7; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.stat-num { font-size: 28px; font-weight: 700; color: #1c1917; line-height: 1; }
.stat-label { font-size: 13px; color: #78716c; margin-top: 4px; }

.top-nav { background: white; border-bottom: 1px solid #e7e5e4; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.top-nav .brand { font-size: 18px; font-weight: 700; color: #b45309; }
.top-nav a { color: #57534e; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.top-nav a:hover { background: #fffbeb; color: #d97706; }
.top-nav a.active { background: #fef3c7; color: #b45309; font-weight: 600; }

/* villa main page */
.villa-bar { background: white; border-bottom: 1px solid #e7e5e4; padding: 10px 24px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.villa-pill {
  padding: 9px 20px; border-radius: 999px; border: 1.5px solid #e7e5e4; background: white;
  font-weight: 600; font-size: 15px; color: #57534e; cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.villa-pill:hover { border-color: #fbbf24; color: #b45309; }
.villa-pill.active { background: #d97706; border-color: #d97706; color: white; box-shadow: 0 4px 12px rgba(217,119,6,0.3); }
.villa-pill .cnt { font-size: 12px; opacity: 0.8; margin-left: 4px; }

.group-section { margin: 22px 24px; }
.group-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: #1c1917; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid #fcd34d; }
.group-title .gcount { font-size: 13px; font-weight: 500; color: #a8a29e; }

.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.mat-card { background: white; border: 1px solid #e7e5e4; border-radius: 12px; padding: 15px; transition: box-shadow 0.15s, border-color 0.15s; position: relative; }
.mat-card:hover { box-shadow: 0 6px 18px rgba(28,25,23,0.08); border-color: #fcd34d; }
.mat-name { font-weight: 700; font-size: 15px; color: #1c1917; margin-bottom: 6px; padding-right: 56px; }
.mat-loc { display: inline-block; font-size: 12px; font-weight: 600; color: #b45309; background: #fef3c7; border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; }
.mat-row { display: flex; gap: 6px; font-size: 13.5px; margin-bottom: 4px; }
.mat-row .k { color: #a8a29e; min-width: 52px; }
.mat-row .v { color: #292524; flex: 1; word-break: break-word; }
.mat-price { color: #b45309; font-weight: 700; }
.mat-note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e7e5e4; font-size: 13px; color: #78716c; white-space: pre-wrap; }
.mat-link { color: #0369a1; text-decoration: none; }
.mat-link:hover { text-decoration: underline; }
.mat-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; }
.icon-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid #e7e5e4; background: white; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn:hover { background: #f5f5f4; }

.empty { text-align: center; padding: 60px; color: #78716c; }

@media (max-width: 640px) {
  .top-nav { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .mat-grid { grid-template-columns: 1fr; }
}
