:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --maxw: 1100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.site-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}
.site-title:hover {
  text-decoration: none;
}
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.main-nav a {
  color: var(--text);
  font-weight: 500;
}

/* ── Layout ── */
.site-main {
  padding-top: 28px;
  padding-bottom: 40px;
}
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}
/* Cho phép cột co lại để pre/table dài cuộn ngang thay vì đẩy tràn màn hình */
.layout > * {
  min-width: 0;
}
@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ── Post grid / cards ── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
@media (max-width: 600px) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: #e9eaec;
}
.card-body {
  padding: 16px;
}
.card-cat {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 700;
}
.card-title {
  font-size: 1.15rem;
  margin: 6px 0 8px;
  line-height: 1.35;
}
.card-title a {
  color: var(--text);
}
.card-excerpt {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}
.card-meta {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Sidebar ── */
.sidebar .widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 24px;
}
.widget h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  padding-bottom: 4px;
}
.widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.widget li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}
.widget li:last-child {
  border-bottom: none;
}
.badge {
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
}

/* ── Single post ── */
.page-title {
  font-size: 1.9rem;
  margin: 0 0 6px;
}
.post-hero {
  display: block;
  width: 100%;
  border-radius: 12px;
  margin: 18px 0;
  max-height: 460px;
  object-fit: cover;
}
.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}
.article-content {
  font-size: 1.05rem;
  overflow-wrap: break-word;
  word-break: break-word;
}
.article-content pre {
  white-space: pre;
  max-width: 100%;
  overflow-x: auto;
}
.article-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.article-content h2,
.article-content h3 {
  margin-top: 1.6em;
}
.article-content pre,
.article-content code {
  background: none;
  border-radius: 4px;
}
.article-content pre {
  padding: 14px 0;
  overflow-x: auto;
}
.article-content blockquote {
  border-left: 4px solid var(--accent);
  margin: 1em 0;
  padding: 4px 16px;
  color: var(--muted);
}
.tag-list {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-list a {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.85rem;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}
.pagination a,
.pagination span {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.pagination span {
  color: var(--muted);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── CTA banner (main site) ── */
.cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent), #1e40af);
  color: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 28px;
}
.cta-banner strong {
  display: block;
  font-size: 1.2rem;
}
.cta-banner span {
  opacity: 0.9;
  font-size: 0.92rem;
}
.cta-btn {
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  white-space: nowrap;
}
.cta-btn:hover {
  text-decoration: none;
  opacity: 0.92;
}

/* ── Signup form ── */
.signup-wrap {
  max-width: 460px;
  margin: 20px auto;
}
.signup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}
.signup-card h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}
.signup-sub {
  color: var(--muted);
  margin: 0 0 20px;
}
.signup-card label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.signup-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 400;
}
.signup-card input:focus {
  outline: none;
  border-color: var(--accent);
}
.signup-subdomain {
  display: flex;
  align-items: center;
  gap: 6px;
}
.signup-subdomain input {
  flex: 1;
}
.signup-subdomain span {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.signup-btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}
.signup-btn:hover {
  text-decoration: none;
  opacity: 0.92;
}
.signup-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.signup-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.signup-success h1 {
  color: #16a34a;
}
.signup-site-link {
  font-size: 1.15rem;
  font-weight: 700;
}
.signup-note {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Tenant directory (main site) ── */
.tenant-directory {
  margin-bottom: 32px;
}
.tenant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.tenant-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.tenant-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.tenant-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.tenant-logo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
}
.tenant-info strong {
  display: block;
}
.tenant-info p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section-title {
  font-size: 1.3rem;
  margin: 0 0 18px;
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
