:root {
  --ink: #202020;
  --ink-soft: #747474;

  --surface: #ffffff;
  --surface-soft: #f7f7f5;

  --border: #e5e2dd;

  --teal: #5bb4ae;
  --plum: #72556f;

  --sidebar-width: 245px;
}

* {
  box-sizing: border-box;
}


body {
  margin: 0;

  background: var(--surface-soft);

  color: var(--ink);

  font-family:
    'DM Sans',
    Arial,
    sans-serif;
}


button,
input,
textarea,
select {
  font: inherit;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.admin-sidebar {
  position: fixed;

  inset: 0 auto 0 0;

  width: var(--sidebar-width);

  display: flex;
  flex-direction: column;

  padding: 32px 18px;

  background: var(--surface);

  border-right: 1px solid var(--border);
}


.admin-brand {
  padding: 5px 12px 40px;
}


.admin-brand h1 {
  margin: 0;

  font-family: 'Fraunces', Georgia, serif;

  font-size: 1.4rem;

  font-weight: 500;
}


.admin-brand span {
  display: block;

  margin-top: 6px;

  color: var(--teal);

  font-size: 0.6rem;

  font-weight: 700;

  letter-spacing: 0.15em;
}


.admin-sidebar nav {
  display: flex;
  flex-direction: column;

  gap: 5px;
}


.nav-item {
  width: 100%;

  padding: 12px 14px;

  border: none;

  border-radius: 9px;

  background: transparent;

  color: var(--ink-soft);

  text-align: left;

  font-size: 0.8rem;

  cursor: pointer;
}


.nav-item:hover {
  background: var(--surface-soft);

  color: var(--ink);
}


.nav-item.active {
  background: rgba(91, 180, 174, 0.1);

  color: var(--teal);

  font-weight: 600;
}


.sidebar-bottom {
  margin-top: auto;

  display: flex;
  flex-direction: column;

  gap: 5px;
}


.sidebar-bottom a,
.sidebar-bottom button {
  padding: 10px 12px;

  border: none;

  border-radius: 9px;

  background: transparent;

  color: var(--ink-soft);

  text-align: left;

  font-size: 0.72rem;

  text-decoration: none;

  cursor: pointer;
}


.sidebar-bottom a:hover,
.sidebar-bottom button:hover {
  background: var(--surface-soft);
}


/* =========================================================
   MAIN
   ========================================================= */

.admin-main {
  min-height: 100vh;

  margin-left: var(--sidebar-width);

  padding: 55px;
}


.admin-page {
  display: none;

  max-width: 1250px;

  margin: 0 auto;
}


.admin-page.active {
  display: block;
}


/* =========================================================
   HEADER
   ========================================================= */

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


.eyebrow {
  display: block;

  margin-bottom: 10px;

  color: var(--teal);

  font-size: 0.64rem;

  font-weight: 700;

  letter-spacing: 0.14em;
}


.page-header h2 {
  margin: 0 0 10px;

  font-family: 'Fraunces', Georgia, serif;

  font-size: clamp(2.4rem, 5vw, 3.8rem);

  font-weight: 500;

  line-height: 1;
}


.page-header p {
  margin: 0;

  color: var(--ink-soft);

  font-size: 0.82rem;

  line-height: 1.7;
}


/* =========================================================
   STATS
   ========================================================= */

.stats {
  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 16px;

  margin-bottom: 25px;
}


.stat-card {
  padding: 24px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: 15px;
}


.stat-card span {
  display: block;

  color: var(--ink-soft);

  font-size: 0.7rem;
}


.stat-card strong {
  display: block;

  margin-top: 12px;

  font-family: 'Fraunces', Georgia, serif;

  font-size: 2.2rem;

  font-weight: 500;
}


/* =========================================================
   WELCOME
   ========================================================= */

.welcome-card {
  max-width: 700px;

  padding: 35px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: 18px;
}


.welcome-card h3 {
  margin: 8px 0 10px;

  font-family: 'Fraunces', Georgia, serif;

  font-size: 1.7rem;

  font-weight: 500;
}


.welcome-card p {
  margin: 0 0 25px;

  color: var(--ink-soft);

  font-size: 0.82rem;

  line-height: 1.7;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.primary-button {
  padding: 11px 17px;

  border: none;

  border-radius: 9px;

  background: var(--plum);

  color: white;

  font-size: 0.75rem;

  font-weight: 600;

  cursor: pointer;
}


.primary-button:hover {
  opacity: 0.9;
}


.primary-button:disabled {
  opacity: 0.6;

  cursor: not-allowed;
}


.secondary-button {
  padding: 11px 17px;

  border: 1px solid var(--border);

  border-radius: 9px;

  background: var(--surface);

  color: var(--ink-soft);

  font-size: 0.75rem;

  cursor: pointer;
}


/* =========================================================
   CLINICS HEADER
   ========================================================= */

.clinic-header {
  display: flex;

  align-items: flex-end;

  justify-content: space-between;

  gap: 30px;
}


/* =========================================================
   TOOLBAR
   ========================================================= */

.clinic-toolbar {
  display: grid;

  grid-template-columns:
    minmax(260px, 2fr)
    repeat(3, minmax(150px, 1fr));

  gap: 10px;

  margin-bottom: 18px;
}


.clinic-toolbar input {
  width: 100%;
}
.clinic-toolbar select {
  padding: 12px 14px;

  border: 1px solid var(--border);

  border-radius: 9px;

  background: var(--surface);

  outline: none;

  font-size: 0.75rem;
}


.clinic-toolbar input {
  width: 350px;
}


.clinic-toolbar input:focus,
.clinic-toolbar select:focus {
  border-color: var(--teal);
}


/* =========================================================
   FEEDBACK TOOLBAR
   (chỉ có 2 cột: search + status filter, khác với clinic
   toolbar có 4 cột search + type + province + ward)
   ========================================================= */

.feedback-toolbar {
  grid-template-columns:
    minmax(260px, 2fr)
    minmax(180px, 1fr);
}


/* =========================================================
   TABLE
   ========================================================= */

.clinic-table-wrapper {
  overflow-x: auto;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: 15px;
}


table {
  width: 100%;

  border-collapse: collapse;
}


th,
td {
  padding: 17px 20px;

  border-bottom: 1px solid var(--border);

  text-align: left;

  font-size: 0.74rem;

  vertical-align: top;
}


th {
  color: var(--ink-soft);

  font-size: 0.62rem;

  font-weight: 600;

  text-transform: uppercase;

  letter-spacing: 0.05em;
}


td strong {
  display: block;

  font-weight: 600;
}


.table-subtext {
  display: block;

  margin-top: 3px;

  color: var(--ink-soft);

  font-size: 0.63rem;
}


.table-action {
  border: none;

  background: transparent;

  color: var(--plum);

  font-size: 0.7rem;

  font-weight: 600;

  cursor: pointer;

  margin-right: 4px;
}


.table-action.danger {
  color: #a45a5a;
}


/* =========================================================
   FEEDBACK ROW READ / UNREAD STATE
   Chưa đọc => nền đậm hơn. Đã đọc => nền nhạt (trắng bình
   thường), chữ nhạt hơn 1 chút.
   ========================================================= */

.feedback-row-unread {
  background: rgba(114, 85, 111, 0.09);
}


.feedback-row-unread td strong {
  font-weight: 700;
}


.feedback-row-read {
  background: var(--surface);
}


.feedback-row-read td {
  color: var(--ink-soft);
}


.feedback-row-read .status-select {
  color: var(--ink-soft);
}


.unread-dot {
  display: inline-block;

  width: 7px;
  height: 7px;

  margin-right: 6px;

  border-radius: 50%;

  background: var(--plum);

  vertical-align: middle;
}


/* =========================================================
   STATUS SELECT (feedback)
   ========================================================= */

.status-select {
  padding: 8px 10px;

  border: 1px solid var(--border);

  border-radius: 8px;

  background: var(--surface);

  color: var(--ink);

  font-size: 0.72rem;

  font-weight: 600;

  outline: none;

  cursor: pointer;
}


.status-select:focus {
  border-color: var(--teal);
}


/* =========================================================
   EMPTY
   ========================================================= */

.empty-state {
  padding: 50px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: 15px;

  text-align: center;
}


.empty-state h3 {
  margin: 0 0 8px;

  font-family: 'Fraunces', Georgia, serif;

  font-weight: 500;
}


.empty-state p {
  margin: 0;

  color: var(--ink-soft);

  font-size: 0.76rem;
}


/* =========================================================
   MODAL
   ========================================================= */

.modal {
  position: fixed;

  inset: 0;

  z-index: 1000;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 25px;
}


.modal.hidden {
  display: none;
}


.modal-overlay {
  position: absolute;

  inset: 0;

  background: rgba(20, 20, 20, 0.38);
}


.modal-card {
  position: relative;

  z-index: 1;

  width: min(760px, 100%);

  max-height: 90vh;

  overflow-y: auto;

  padding: 32px;

  background: var(--surface);

  border-radius: 20px;
}


body.modal-open {
  overflow: hidden;
}


.modal-header {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  margin-bottom: 28px;
}


.modal-header h2 {
  margin: 0;

  font-family: 'Fraunces', Georgia, serif;

  font-size: 2rem;

  font-weight: 500;
}


.close-button {
  width: 34px;
  height: 34px;

  border: none;

  border-radius: 50%;

  background: var(--surface-soft);

  color: var(--ink-soft);

  font-size: 1.2rem;

  cursor: pointer;
}


/* =========================================================
   FEEDBACK DETAIL MODAL (2 box side-by-side)
   ========================================================= */

.feedback-detail-card {
  width: min(980px, 100%);
}


.feedback-detail-grid {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 20px;
}


.feedback-detail-box {
  padding: 22px;

  border: 1px solid var(--border);

  border-radius: 15px;

  background: var(--surface-soft);

  display: flex;
  flex-direction: column;
}


.feedback-detail-box h3 {
  margin: 0 0 16px;

  font-family: 'Fraunces', Georgia, serif;

  font-size: 1.05rem;

  font-weight: 500;
}


.feedback-meta {
  margin: 0 0 16px;

  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 12px 16px;
}


.feedback-meta div {
  min-width: 0;
}


.feedback-meta dt {
  margin: 0 0 3px;

  color: var(--ink-soft);

  font-size: 0.62rem;

  font-weight: 600;

  text-transform: uppercase;

  letter-spacing: 0.05em;
}


.feedback-meta dd {
  margin: 0;

  font-size: 0.78rem;

  font-weight: 600;

  word-break: break-word;
}


.feedback-message-box {
  flex: 1;

  padding: 16px;

  background: var(--surface);

  border: 1px solid var(--border);

  border-radius: 10px;

  font-size: 0.8rem;

  line-height: 1.7;

  white-space: pre-wrap;

  word-break: break-word;

  min-height: 160px;
}


.feedback-hint {
  margin: 0 0 14px;

  color: var(--ink-soft);

  font-size: 0.68rem;

  line-height: 1.6;
}


#fbReplyText {
  flex: 1;

  width: 100%;

  min-height: 200px;

  padding: 14px;

  border: 1px solid var(--border);

  border-radius: 10px;

  background: var(--surface);

  color: var(--ink);

  font-size: 0.8rem;

  line-height: 1.6;

  resize: vertical;

  outline: none;
}


#fbReplyText:focus {
  border-color: var(--teal);
}


.feedback-detail-actions {
  display: flex;

  justify-content: flex-end;

  gap: 10px;

  margin-top: 16px;
}


@media (max-width: 800px) {

  .feedback-detail-grid {
    grid-template-columns: 1fr;
  }

}


/* =========================================================
   FORM
   ========================================================= */

.form-section {
  padding: 25px 0;

  border-top: 1px solid var(--border);
}


.form-section:first-of-type {
  border-top: none;
}


.form-section h3 {
  margin: 0 0 20px;

  font-family: 'Fraunces', Georgia, serif;

  font-size: 1.2rem;

  font-weight: 500;
}


.form-section label {
  display: block;

  margin-bottom: 16px;

  color: var(--ink-soft);

  font-size: 0.68rem;

  font-weight: 600;
}


.form-section input,
.form-section textarea,
.form-section select {
  display: block;

  width: 100%;

  margin-top: 7px;

  padding: 11px 12px;

  border: 1px solid var(--border);

  border-radius: 9px;

  background: var(--surface);

  color: var(--ink);

  outline: none;

  font-size: 0.76rem;

  font-weight: 400;

  resize: vertical;
}


.form-section input:focus,
.form-section textarea:focus,
.form-section select:focus {
  border-color: var(--teal);
}


.form-grid {
  display: grid;

  grid-template-columns:
    repeat(2, 1fr);

  gap: 15px;
}


/* =========================================================
   PRICE RANGE (A - B VNĐ)
   ========================================================= */

.price-range-grid {
  margin-top: 7px;
}


.field-hint {
  display: block;

  margin-top: 6px;

  color: var(--ink-soft);

  font-size: 0.62rem;

  font-weight: 400;

  line-height: 1.5;
}


/* =========================================================
   SERVICES CHECKBOX GRID
   ========================================================= */

.checkbox-grid {
  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 8px 12px;

  margin-top: 7px;

  padding: 14px;

  border: 1px solid var(--border);

  border-radius: 9px;

  background: var(--surface-soft);
}


.checkbox-item {
  display: flex !important;

  flex-direction: row !important;

  align-items: center;

  gap: 7px;

  margin-bottom: 0 !important;

  padding: 6px 8px;

  border-radius: 7px;

  color: var(--ink) !important;

  font-size: 0.74rem !important;

  font-weight: 400 !important;

  cursor: pointer;
}


.checkbox-item:hover {
  background: var(--surface);
}


.checkbox-item input[type="checkbox"] {
  width: 15px;
  height: 15px;

  margin: 0;

  flex-shrink: 0;

  accent-color: var(--plum);

  cursor: pointer;
}


@media (max-width: 800px) {

  .checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }

}


/* =========================================================
   FORM ACTIONS
   ========================================================= */

.form-actions {
  display: flex;

  justify-content: flex-end;

  gap: 10px;

  padding-top: 25px;

  border-top: 1px solid var(--border);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 800px) {

  .admin-sidebar {
    position: static;

    width: 100%;

    border-right: none;

    border-bottom: 1px solid var(--border);
  }


  .admin-sidebar nav {
    flex-direction: row;

    overflow-x: auto;
  }


  .nav-item {
    width: auto;

    white-space: nowrap;
  }


  .sidebar-bottom {
    display: none;
  }


  .admin-main {
    margin-left: 0;

    padding: 30px 20px 60px;
  }


  .stats {
    grid-template-columns: 1fr;
  }


  .clinic-header {
    align-items: flex-start;

    flex-direction: column;
  }


  .clinic-toolbar {
    flex-direction: column;
  }


  .clinic-toolbar input {
    width: 100%;
  }


  .form-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 900px) {

  .clinic-toolbar {
    grid-template-columns: 1fr 1fr;
  }

}

.article-modal-card{ width: min(880px, 100%); }
.article-toolbar{ grid-template-columns: minmax(260px,2fr) minmax(180px,1fr); }

.article-editor-box{
  min-height: 320px;
  background: var(--surface);
  border-radius: 0 0 9px 9px;
  font-size: 0.85rem;
}
.article-editor-box .ql-editor{ min-height: 280px; }
.ql-toolbar.ql-snow{
  border: 1px solid var(--border) !important;
  border-radius: 9px 9px 0 0;
  background: var(--surface-soft);
}
.ql-container.ql-snow{ border: 1px solid var(--border) !important; }

.status-pill{
  display:inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-pill.draft{ background: rgba(114,85,111,0.12); color: var(--plum); }
.status-pill.published{ background: rgba(91,180,174,0.14); color: var(--teal); }