:root {
  /* samakan dengan dashboard */
  --line: #2f2f2f;
  --muted: #a1a1aa;
  --text: #ececec;

  --red: #ef4444;
  --green: #22c55e;

  --blue: #3b82f6;
  --blue-dark: #2563eb;

  --card: #1f1f1f;
  --card-2: #171717;
  --bg: #212121;

  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.24);

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.app {
  width: 100%;
  min-width: 840px;
  height: calc(100vh - 16px);
  min-height: calc(100vh - 16px);
  background: var(--card-2);
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.left-rail {
  background: var(--card-2);
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 12px;
  min-height: 0;
}

.rail-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
  width: calc(100% - 16px);
}

.rail-icon.flash.active {
  background: #2f6fed;
  box-shadow: none;
}

.main {
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--bg);
  flex-shrink: 0;
}

.page-title-wrap {
  min-width: 0;
}

.page-title-wrap h1 {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title-wrap p {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 10px;
}

.content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.content::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.page-card {
  min-height: 100%;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.page-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px;
  background: #2a2a2a;
  border: 1px solid #343434;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.new-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #2f6fed;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
  white-space: nowrap;
}

.new-btn:hover {
  background: #3b7cff;
  transform: translateY(-1px);
}

.new-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.search-wrap {
  width: 320px;
  max-width: 100%;
  height: 38px;
  border-radius: 12px;
  background: #1f1f1f;
  border: 1px solid #343434;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
}

.search-wrap:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.search-wrap svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.search-wrap input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 13px;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.count-bar {
  min-height: 42px;
  border-radius: 14px;
  background: #1f1f1f;
  border: 1px solid #343434;
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
}

.sync-note {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.1);
  color: #d7e7ff;
  font-size: 13px;
  line-height: 1.6;
}

.response-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.response-card {
  background: #1f1f1f;
  border: 1px solid #343434;
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.response-card:hover {
  border-color: #404040;
  transform: translateY(-1px);
}

.response-title {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.response-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.response-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #d7e7ff;
  font-size: 12px;
  font-weight: 700;
}

.response-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 16px;
  white-space: pre-line;
  word-break: break-word;
}

.response-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.action-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.response-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #2a2a2a;
  color: #ececec;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
  border-color: #474747;
  background: #323232;
}

.action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.action-btn.edit {
  color: #d7e7ff;
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.1);
}

.action-btn.edit:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.3);
}

.action-btn.delete {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.1);
}

.action-btn.delete:hover {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2f6fed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  text-transform: uppercase;
}

.empty-state {
  display: none;
  padding: 28px 18px;
  border: 1px dashed #3c3c3c;
  background: #1f1f1f;
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text);
}

.empty-state.show {
  display: block;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #ffffff;
}

.empty-state p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.76);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 9999;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  width: min(100%, 760px);
  background: #171717;
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
}

.modal-overlay.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.modal-header p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

#responseForm {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-body {
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: transparent;
  flex: 1;
  overflow: auto;
}

.modal-footer {
  padding: 18px 22px 22px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-label {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.form-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: -2px;
}

.modal-input,
.modal-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #343434;
  background: #212121;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.modal-input {
  height: 48px;
  padding: 0 14px;
  font-size: 14px;
}

.modal-textarea {
  min-height: 180px;
  resize: vertical;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
}

.modal-input::placeholder,
.modal-textarea::placeholder {
  color: #8d8d95;
}

.modal-input:focus,
.modal-textarea:focus {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
  background: #242424;
}

.modal-input.error,
.modal-textarea.error {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.field-error {
  display: none;
  font-size: 13px;
  color: #fecaca;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  margin-top: 2px;
}

.field-error.show {
  display: inline-flex;
}

.field-error .error-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--red);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.btn-batal,
.btn-simpan {
  min-width: 110px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn-batal {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #ececec;
}

.btn-batal:hover {
  background: #323232;
  border-color: #474747;
  transform: translateY(-1px);
}

.btn-simpan {
  background: #2f6fed;
  border: 1px solid transparent;
  color: #fff;
}

.btn-simpan:hover {
  background: #3b7cff;
  transform: translateY(-1px);
}

.btn-simpan:disabled,
.btn-batal:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* versi modal tambah respon yang lebih lega, tapi tetap satu bahasa dengan dashboard */
#modalTambahRespon.modal-overlay {
  padding: clamp(20px, 4vw, 40px);
}

#modalTambahRespon .modal-card {
  width: min(920px, calc(100vw - 48px));
  max-width: min(920px, calc(100vw - 48px));
  max-height: min(88vh, 820px);
}

#modalTambahRespon .modal-header {
  padding: 24px 26px 18px;
}

#modalTambahRespon .modal-header h2 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 8px;
}

#modalTambahRespon .modal-header p {
  margin: 0;
  max-width: 720px;
}

#modalTambahRespon .modal-body {
  padding: 22px 26px 20px;
  gap: 22px;
}

#modalTambahRespon .modal-textarea {
  min-height: 220px;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.75;
}

#modalTambahRespon .modal-input {
  height: 50px;
  padding: 0 16px;
  font-size: 15px;
}

#modalTambahRespon .modal-footer {
  padding: 18px 26px 24px;
  gap: 12px;
}

#modalTambahRespon .btn-batal,
#modalTambahRespon .btn-simpan {
  min-width: 124px;
  height: 46px;
  border-radius: 14px;
}

/* avatar rail profil */
.rail-icon .rail-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.rail-icon.has-avatar {
  padding: 0;
  overflow: hidden;
}

.rail-icon.has-avatar svg {
  display: none;
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  body {
    padding: 0;
  }

  .app {
    min-height: 100vh;
    height: 100vh;
    border-radius: 0;
    max-width: none;
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 12px 14px;
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .page-title-wrap h1,
  .page-title-wrap p {
    white-space: normal;
  }

  .content {
    padding: 14px;
  }

  .toolbar-row {
    padding: 14px;
    align-items: stretch;
  }

  .new-btn {
    width: 100%;
  }

  .search-wrap {
    width: 100%;
  }

  .response-actions {
    margin-left: 0;
    width: 100%;
  }

  .action-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  #modalTambahRespon.modal-overlay {
    padding: 14px;
  }

  #modalTambahRespon .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 18px;
    max-height: 92vh;
  }

  #modalTambahRespon .modal-header,
  #modalTambahRespon .modal-body,
  #modalTambahRespon .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  #modalTambahRespon .modal-header h2 {
    font-size: 22px;
  }

  #modalTambahRespon .modal-textarea {
    min-height: 180px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .btn-batal,
  .btn-simpan {
    width: 100%;
  }
}