:root {
  --indigo: #24364b;
  --indigo-dark: #16222e;
  --red: #c84a4a;
  --forest: #426b52;
  --gold: #c9a15c;
  --cream: #faf7f0;
  --text: #252525;
  --text-muted: #6e6e6e;
  --surface: #ffffff;
  --outline: #e6e1d6;
  --error: #b3261e;
}

* {
  box-sizing: border-box;
}

/* .app-shell/.access-denied both set an explicit `display`, which — at
   equal CSS specificity — beats the browser's default `[hidden] { display:
   none }` simply because this stylesheet loads after the UA one. Without
   this, toggling the `hidden` attribute from JS silently does nothing and
   both panels can end up visible at once (e.g. a stale "Đang tải..." table
   stacked above the real "Không có quyền truy cập" message). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Noto Sans', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* ---------- Login page ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 28px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-google:hover {
  background: var(--cream);
}

.btn-google img {
  width: 20px;
  height: 20px;
}

.login-error {
  margin-top: 16px;
  color: var(--error);
  font-size: 14px;
}

.login-error:empty {
  display: none;
}

/* ---------- Access denied ---------- */

.access-denied {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.access-denied .card {
  max-width: 420px;
  text-align: center;
  padding: 40px 36px;
}

.access-denied h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

.access-denied p {
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--indigo);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  font-weight: 700;
  font-size: 15px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--outline);
  background: var(--surface);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--outline);
}

#user-name {
  font-size: 14px;
  font-weight: 500;
}

.btn-ghost {
  border: 1px solid var(--outline);
  background: transparent;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.btn-ghost:hover {
  background: var(--cream);
}

.page-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1100px;
}

/* ---------- Cards / stats ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 20px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card .stat-value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--indigo);
}

.stat-card.accent-red .stat-value {
  color: var(--red);
}

.stat-card.accent-forest .stat-value {
  color: var(--forest);
}

.stat-card.accent-gold .stat-value {
  color: var(--gold);
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
}

/* ---------- Table ---------- */

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--outline);
  white-space: nowrap;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tbody tr:hover {
  background: var(--cream);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin {
  background: rgba(36, 54, 75, 0.1);
  color: var(--indigo);
}

.badge-muted {
  background: var(--outline);
  color: var(--text-muted);
}

.table-search {
  margin-bottom: 16px;
  max-width: 320px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  font-size: 14px;
  font-family: inherit;
}

.table-state {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Filter tabs (feedback) ---------- */

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tab {
  border: 1px solid var(--outline);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-tab:hover {
  background: var(--cream);
}

.filter-tab.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}

/* ---------- Status select (feedback) ---------- */

.status-select {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236E6E6E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.status-select.status-new {
  background-color: rgba(36, 54, 75, 0.12);
  color: var(--indigo);
}

.status-select.status-in_progress {
  background-color: rgba(201, 161, 92, 0.22);
  color: #8a6a2e;
}

.status-select.status-resolved {
  background-color: rgba(66, 107, 82, 0.15);
  color: var(--forest);
}

.status-select.status-rejected {
  background-color: rgba(200, 74, 74, 0.14);
  color: var(--red);
}

.clickable-row {
  cursor: pointer;
}

/* ---------- Article detail modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 34, 46, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  max-width: 720px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: var(--cream);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.modal-cover {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 16px;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 32px 8px 0;
}

.modal-title-row h2 {
  margin: 0;
  font-size: 22px;
}

.modal-status-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.modal-status-badge.status-new {
  background-color: rgba(36, 54, 75, 0.12);
  color: var(--indigo);
}

.modal-status-badge.status-in_progress {
  background-color: rgba(201, 161, 92, 0.22);
  color: #8a6a2e;
}

.modal-status-badge.status-resolved {
  background-color: rgba(66, 107, 82, 0.15);
  color: var(--forest);
}

.modal-status-badge.status-rejected {
  background-color: rgba(200, 74, 74, 0.14);
  color: var(--red);
}

.modal-alert {
  background: rgba(179, 38, 30, 0.08);
  border: 1px solid rgba(179, 38, 30, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.modal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 20px;
  margin-bottom: 20px;
}

.modal-meta-item span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.modal-meta-item strong {
  font-size: 14px;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.modal-section p {
  margin: 0;
}

.modal-content-text {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.6;
}

.modal-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.modal-gallery img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
}

.modal-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.modal-history li {
  padding-left: 14px;
  border-left: 2px solid var(--outline);
}

/* ---------- Coming soon ---------- */

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.coming-soon .icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.coming-soon h2 {
  color: var(--text);
  font-size: 20px;
  margin: 0 0 8px;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    overflow-x: auto;
  }

  .sidebar-brand {
    padding: 0 12px 0 0;
  }

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

  .topbar,
  .page-content {
    padding: 16px;
  }
}
