:root {
  --brand: #15365F;
  --brand-700: #0F2848;
  --brand-600: #1D4677;
  --brand-100: #DCE6F2;
  --brand-50: #EEF3F9;
  --accent: #E31E26;
  --accent-50: #FDEDEE;
  --bg: #F3F5F9;
  --card: #FFFFFF;
  --ink: #0F1E33;
  --graphite: #455468;
  --muted: #7B8798;
  --faint: #B9C2CE;
  --line: #E6EAF0;
  --line2: #D6DDE7;
  --ok: #1A7F4E;
  --ok-bg: #E7F6EE;
  --ok-bd: #BFE5CF;
  --warn: #B4610A;
  --warn-bg: #FFF4E2;
  --warn-bd: #F6D9A8;
  --sh-1: 0 1px 3px rgba(15, 30, 51, 0.08), 0 1px 2px rgba(15, 30, 51, 0.05);
  --sh-2: 0 10px 30px rgba(15, 30, 51, 0.12);
}

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

body {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

/* ========================================================
   1. ADMIN HEADER
   ======================================================== */
.admin-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sh-1);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex: none;
}

.header-brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.header-brand p {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-portal, .btn-export {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-portal {
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand);
}
.btn-portal:hover {
  background: var(--brand-100);
}

.export-dropdown {
  position: relative;
}

.btn-export {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
}
.btn-export:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
}

.dropdown-panel {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  width: 220px;
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 10px;
  box-shadow: var(--sh-2);
  padding: 6px;
  z-index: 110;
}

.dropdown-panel.open {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}
.dropdown-item:hover {
  background: var(--brand-50);
}
.dropdown-item strong {
  display: block;
  font-size: 12.5px;
  color: var(--brand);
}
.dropdown-item small {
  font-size: 10.5px;
  color: var(--muted);
}

/* ========================================================
   2. MAIN CONTAINER & DASHBOARD SECTION
   ======================================================== */
.admin-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--sh-1);
}

.kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  margin: 6px 0 2px;
  line-height: 1;
}

.text-accent { color: var(--accent); }
.text-ok { color: var(--ok); }
.text-brand { color: var(--brand); }

.kpi-desc {
  font-size: 11.5px;
  color: var(--graphite);
}

.progress-bar-wrap {
  width: 100%;
  height: 7px;
  background: var(--brand-50);
  border-radius: 999px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--ok);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .analytics-grid { grid-template-columns: 1fr; }
}

.analytics-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--sh-1);
}

.analytics-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.module-bar-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.module-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}

.module-name {
  width: 140px;
  font-weight: 500;
  color: var(--graphite);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-bar-track {
  flex: 1;
  height: 10px;
  background: var(--brand-50);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
}

.module-bar-fill {
  height: 100%;
  background: var(--brand-600);
}
.module-bar-fill.open-part {
  background: var(--accent);
}

.module-counts {
  width: 70px;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kind-distribution {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kind-pill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
}
.kind-pill-row.question { background: #E0F2FE; color: #0369A1; }
.kind-pill-row.issue { background: #FEE2E2; color: #B91C1C; }
.kind-pill-row.suggestion { background: #FEF3C7; color: #B45309; }
.kind-pill-row.logic { background: #EDE9FE; color: #6D28D9; }

.empty-hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

/* ========================================================
   3. FILTER TOOLBAR
   ======================================================== */
.filter-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--sh-1);
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.filter-item label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-item select, .filter-item input {
  padding: 8px 12px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
}

.filter-item.search-box {
  flex: 2;
  min-width: 220px;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 11px;
  top: 11px;
  color: var(--muted);
}

.search-input-wrap input {
  width: 100%;
  padding-left: 34px;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-inputs input {
  width: 135px;
}

.btn-reset {
  padding: 8px 16px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
}
.btn-reset:hover {
  background: var(--brand-100);
}

/* ========================================================
   4. DATA TABLE & PAGINATION
   ======================================================== */
.table-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.table-header-info {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header-info h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
}

.table-counter {
  font-size: 12px;
  color: var(--muted);
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--brand-50);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--graphite);
}

.data-table tr:hover td {
  background: #FAFCFF;
}

/* 1-Click Toggle Status Button */
.btn-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-status-toggle.open {
  background: #FEF3C7;
  color: #B45309;
}
.btn-status-toggle.open:hover {
  background: #FDE68A;
}

.btn-status-toggle.resolved {
  background: #D1FAE5;
  color: #065F46;
}
.btn-status-toggle.resolved:hover {
  background: #A7F3D0;
}

.module-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  background: var(--brand-50);
  color: var(--brand);
  padding: 2px 7px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.screen-name {
  display: block;
  font-weight: 600;
  color: var(--ink);
}

.element-tag-badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  background: #E2E8F0;
  color: #334155;
  padding: 1px 5px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.element-label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.author-name {
  font-weight: 600;
  color: var(--brand);
  display: block;
}

.created-date {
  font-size: 11px;
  color: var(--muted);
}

.comment-body-text {
  color: var(--ink);
  line-height: 1.45;
  font-weight: 500;
}

.comment-detail-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}

.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.btn-icon-action {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line2);
  background: #fff;
  color: var(--graphite);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-icon-action.primary {
  background: var(--brand-50);
  border-color: var(--brand-100);
  color: var(--brand);
}
.btn-icon-action.primary:hover {
  background: var(--brand);
  color: #fff;
}

.btn-icon-action.danger:hover {
  background: #FEE2E2;
  color: var(--accent);
  border-color: #FECACA;
}

/* Pagination Footer */
.pagination-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.page-size-selector select {
  padding: 4px 8px;
  border: 1px solid var(--line2);
  border-radius: 6px;
  font-size: 12.5px;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-page {
  padding: 6px 12px;
  border: 1px solid var(--line2);
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-page:hover:not(:disabled) {
  background: var(--brand-50);
  color: var(--brand);
}
.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--graphite);
}

/* ========================================================
   5. MODAL TECH DETAILS
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 51, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  place-items: center;
  padding: 16px;
}

.modal-overlay.open {
  display: grid;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--sh-2);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 15px;
  color: var(--brand);
}

.btn-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

.tech-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}

.tech-item {
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: 8px;
  padding: 10px 12px;
}

.tech-item strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 3px;
}

.tech-item code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  padding: 8px 16px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10005;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
