/* =============================================================================
 * staff_housing.css  — Gaya modul Aset Bangunan Rumah Staff
 * Tambahkan setelah marketplace.css.
 * Memakai variabel tema dari app.css
 * (--bg --card --text --muted --line --primary --primary2 --danger --warning --shadow --radius)
 * ============================================================================= */

/* ---------- Tombol Daftar Staff di layar login ---------- */
.sh-register-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.sh-register-divider::before,
.sh-register-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.sh-register-btn {
  width: 100%;
  justify-content: center;
  font-size: 14px;
  padding: 12px;
  border-radius: 14px;
}

/* ---------- Modal Registrasi Staff ---------- */
.sh-reg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.64);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 25;
}
.sh-reg-card {
  width: min(500px, 100%);
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sh-reg-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.sh-reg-head h2 { margin: 0 0 4px; font-size: 18px; }
.sh-reg-form {
  padding: 20px 24px 24px;
  display: grid;
  gap: 4px;
}
.sh-reg-preview {
  background: rgba(20,184,166,.10);
  border: 1px solid rgba(20,184,166,.30);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
}
.sh-reg-msg {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.5;
}
.sh-reg-success {
  background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.28);
  color: #15803d;
}
.sh-reg-error {
  background: rgba(220,38,38,.10);
  border: 1px solid rgba(220,38,38,.25);
  color: var(--danger);
}
.sh-reg-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---------- Label staff di sidebar ---------- */
.sh-user-name {
  display: block;
  font-weight: 750;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sh-user-title {
  display: block;
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Container utama halaman staff ---------- */
.sh-wrap { display: grid; gap: 16px; }

.sh-loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.sh-error {
  padding: 20px;
  background: rgba(220,38,38,.08);
  border: 1px solid rgba(220,38,38,.22);
  border-radius: 16px;
  color: var(--danger);
}

/* ---------- Card intro / welcome ---------- */
.sh-intro-card {
  text-align: center;
  padding: 36px 24px;
}
.sh-intro-icon {
  font-size: 52px;
  margin-bottom: 12px;
}
.sh-intro-card h2 { margin: 0 0 8px; }

.sh-section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ---------- Grid pilih tipe rumah ---------- */
.sh-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.sh-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 22px 14px 18px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, transform .12s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.sh-type-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(20,184,166,.18);
}
.sh-type-card strong { font-size: 16px; }
.sh-type-icon { font-size: 38px; }
.sh-type-desc { font-size: 12px; }
.sh-type-meta {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(20,184,166,.10);
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 2px;
}

/* ---------- Card konfirmasi (edit atau baru) ---------- */
.sh-confirm-card {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  padding: 36px 28px;
}
.sh-confirm-icon { font-size: 48px; margin-bottom: 12px; }
.sh-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ---------- Header tabel perabot ---------- */
.sh-table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.sh-table-header h3 {
  margin: 6px 0 4px;
  font-size: 18px;
}
.sh-table-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.sh-back-btn { padding: 7px 12px; font-size: 13px; }
.sh-type-badge {
  display: inline-block;
  background: rgba(20,184,166,.14);
  color: var(--primary);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 14px;
  font-weight: 800;
}

/* ---------- Tabel perabot ---------- */
.sh-table-wrap { padding: 0; overflow: hidden; }
.sh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sh-table th {
  font-size: 11px;
  color: var(--muted);
  background: rgba(148,163,184,.10);
  padding: 10px 8px;
  white-space: nowrap;
}
.sh-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.sh-table tr.sh-row-custom td { background: rgba(20,184,166,.04); }
.sh-table tr:last-child td    { border-bottom: 0; }

.sh-th-no,   .sh-td-no     { width: 40px;  text-align: center; }
.sh-th-c,    .sh-td-center { width: 76px;  text-align: center; }
.sh-th-kondisi,.sh-td-kondisi { width: 130px; }
.sh-th-del,  .sh-td-del    { width: 40px;  text-align: center; }

.sh-item-name { font-weight: 700; display: block; }
.sh-qty-input {
  width: 64px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  font-size: 13px;
}
.sh-inline-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}
.sh-sel-kondisi {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}
.sh-inp-notes { min-width: 120px; }

/* Badge selisih */
.sh-badge-ok     { background: rgba(22,163,74,.14);  color: #16a34a; }
.sh-badge-kurang { background: rgba(220,38,38,.12);  color: var(--danger); }
.sh-badge-lebih  { background: rgba(217,119,6,.12);  color: var(--warning); }

/* Footer tabel */
.sh-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  gap: 10px;
  flex-wrap: wrap;
}

/* Pesan simpan */
.sh-save-msg {
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.5;
}
.sh-save-success {
  background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.28);
  color: #15803d;
}
.sh-save-error {
  background: rgba(220,38,38,.10);
  border: 1px solid rgba(220,38,38,.22);
  color: var(--danger);
}

/* ---------- Daftar Rumah Saya ---------- */
.sh-mylist-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.sh-mylist-header h3 { margin: 0 0 4px; }
.sh-mylist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.sh-mylist-card { display: flex; flex-direction: column; gap: 8px; }
.sh-mylist-top  { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sh-mylist-name { margin: 0; font-size: 16px; }
.sh-mylist-meta { font-size: 12px; margin: 0; }
.sh-mylist-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.sh-mylist-actions .btn { flex: 1; font-size: 13px; padding: 8px; }

.sh-type-badge-lg {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(20,184,166,.12);
  border-radius: 999px;
  padding: 4px 12px;
}

/* Card kosong */
.sh-empty-card {
  text-align: center;
  padding: 52px 24px;
  max-width: 440px;
  margin: 0 auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sh-type-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .sh-table-header {
    flex-direction: column;
    align-items: stretch;
  }
  .sh-table-actions { justify-content: stretch; }
  .sh-table-actions .btn { flex: 1; }
}

@media (max-width: 640px) {
  .sh-reg-card { border-radius: 18px; }
  .sh-reg-form { padding: 16px 18px 20px; }
  .sh-type-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .sh-type-card { padding: 16px 10px; }
  .sh-type-icon { font-size: 30px; }
  .sh-table { font-size: 12px; }
  .sh-table td, .sh-table th { padding: 7px 5px; }
  .sh-qty-input { width: 52px; }
  .sh-th-kondisi, .sh-td-kondisi { display: none; } /* lipat di mobile kecil */
  .sh-mylist-grid { grid-template-columns: 1fr; }
  .sh-confirm-actions { flex-direction: column; }
  .sh-confirm-actions .btn { width: 100%; }
  .sh-table-footer { flex-direction: column; }
  .sh-table-footer .btn { width: 100%; }
}

@media (max-width: 480px) {
  .sh-register-btn { font-size: 13px; }
  .sh-reg-actions { flex-direction: column; }
  .sh-reg-actions .btn { width: 100%; }
}

/* ---------- Admin: Modal detail rumah staff (Fase 3-5) ---------- */
.sh-admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.sh-admin-user-info strong { font-size: 16px; }

.sh-admin-house-list  { display: grid; gap: 10px; margin-bottom: 16px; }
.sh-admin-house-row   {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(148,163,184,.04);
  flex-wrap: wrap;
}
.sh-admin-house-info  { display: flex; flex-direction: column; gap: 3px; }
.sh-admin-house-info strong { font-size: 14px; }
.sh-admin-house-actions { display: flex; gap: 8px; flex-shrink: 0; }

.sh-admin-detail-box  { margin-top: 8px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.sh-admin-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(148,163,184,.06);
  flex-wrap: wrap;
  gap: 10px;
}
.sh-admin-detail-head h4   { margin: 0; font-size: 14px; }
.sh-admin-detail-acts      { display: flex; gap: 8px; }
.sh-admin-detail-box .table-wrap { border: 0; border-radius: 0; }

.sh-reassign-box {
  margin-top: 12px;
  border: 1px solid rgba(217,119,6,.30);
  border-radius: 14px;
  padding: 16px;
  background: rgba(217,119,6,.06);
}
.sh-reassign-box h4    { margin: 0 0 8px; font-size: 14px; }
.sh-reassign-actions   { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

.sh-sel-custom-cat {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .sh-admin-house-row     { flex-direction: column; align-items: stretch; }
  .sh-admin-house-actions { justify-content: stretch; }
  .sh-admin-house-actions .btn { flex: 1; }
  .sh-admin-detail-head   { flex-direction: column; align-items: stretch; }
  .sh-admin-detail-acts .btn { flex: 1; }
  .sh-reassign-actions    { flex-direction: column; }
  .sh-reassign-actions .btn { width: 100%; }
}

/* ---------- Auto-suggest dropdown ---------- */
.sh-suggest-wrap { position: relative; }
.sh-suggest-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}
.sh-sug-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.sh-sug-item:last-child { border-bottom: 0; }
.sh-sug-item:hover { background: rgba(20,184,166,.10); }
.sh-sug-item strong { font-size: 13px; }
.sh-sug-item small  { font-size: 11px; color: var(--muted); }

/* ---------- Dashboard KPI ---------- */
.sh-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.sh-kpi-type { margin-top: 12px; }
.sh-kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.sh-kpi-card small { display: block; font-size: 12px; color: var(--muted); }
.sh-kpi-card b     { display: block; font-size: 32px; font-weight: 900; margin: 6px 0 4px; }
.sh-kpi-card span  { font-size: 12px; }
.sh-kpi-primary { border-top: 3px solid var(--primary); }
.sh-kpi-primary b { color: var(--primary); }
.sh-kpi-warn    { border-top: 3px solid var(--warning); }
.sh-kpi-warn b  { color: var(--warning); }
.sh-kpi-danger  { border-top: 3px solid var(--danger); }
.sh-kpi-danger b { color: var(--danger); }
.sh-kpi-info    { border-top: 3px solid #2563eb; }
.sh-kpi-info b  { color: #2563eb; }

/* Dashboard 2-col chart grid */
.sh-dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.sh-dash-grid .card h3 { margin: 0 0 14px; font-size: 14px; }

/* Bar chart */
.sh-bar-list   { display: grid; gap: 8px; }
.sh-bar-row    {}
.sh-bar-label  { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.sh-bar-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80%; }
.sh-bar-label b    { font-weight: 800; flex-shrink: 0; }
.sh-bar-track  { height: 8px; background: rgba(148,163,184,.15); border-radius: 999px; overflow: hidden; }
.sh-bar-fill   { height: 100%; border-radius: 999px; transition: width .3s; }

@media (max-width: 900px) {
  .sh-dash-grid       { grid-template-columns: 1fr; }
  .sh-kpi-row         { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .sh-kpi-row         { grid-template-columns: 1fr 1fr; }
  .sh-kpi-card b      { font-size: 26px; }
}
