/* qateamai.com Platform — dark theme, CTS Nordics palette
   Primary green : #2f9e44   (action, links)  ← brand accent
   Light green   : #57d364   (hover accents)
   Gold accent   : #f0a500   (brand highlight)
   Background    : #0d1117   (body)
   Surface       : #161b22   (cards, navbar)
   Surface-alt   : #21262d   (inputs, table rows alt)
   Border        : #30363d
   Text-primary  : #e6edf3
   Text-muted    : #8b949e
*/

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ────────────────────────────────────────────────────────────────────── */
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: #2f9e44; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ──────────────────────────────────────────────────────────────────── */
.navbar {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand a {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e6edf3;
  letter-spacing: -0.02em;
}
.nav-brand a span:first-child { color: #f0a500; }
.nav-tagline {
  font-size: 0.72rem;
  color: #8b949e;
  margin-left: 0.6rem;
  display: none;
}
@media (min-width: 640px) { .nav-tagline { display: inline; } }

.nav-links { display: flex; align-items: center; gap: 0.75rem; }
.nav-link {
  color: #8b949e;
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.nav-link:hover { color: #e6edf3; text-decoration: none; }
.nav-link.active { color: #e6edf3; }
.nav-divider { color: #30363d; }
.nav-user { font-size: 0.8rem; color: #8b949e; }
.nav-logout { color: #8b949e; }

/* ── Main containers ─────────────────────────────────────────────────────────── */
main { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Auth pages ─────────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px - 42px);
  padding: 2rem 1rem;
}
.auth-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.auth-logo { margin-bottom: 1.25rem; }
.logo-mark { font-size: 1.8rem; font-weight: 800; color: #f0a500; }
.logo-team { font-size: 1.8rem; font-weight: 700; color: #e6edf3; }
.auth-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.4rem; }
.auth-sub { color: #8b949e; font-size: 0.875rem; margin-bottom: 1.5rem; }
.auth-switch { font-size: 0.85rem; color: #8b949e; margin-top: 1.25rem; }
.auth-form { text-align: left; }

/* pending page */
.pending-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.pending-hint { font-size: 0.8rem; color: #8b949e; margin-top: 1rem; }

/* error pages */
.error-card { max-width: 380px; }
.error-code { font-size: 4rem; font-weight: 800; color: #30363d; line-height: 1; margin-bottom: 1rem; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: #8b949e;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: #2f9e44;
}
input::placeholder { color: #484f58; }

.form-row { display: grid; gap: 1rem; }
@media (min-width: 600px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-primary  { background: #2f9e44; color: #fff; }
.btn-secondary{ background: transparent; border-color: #30363d; color: #8b949e; }
.btn-secondary:hover { border-color: #8b949e; color: #e6edf3; }
.btn-success  { background: #2ea043; color: #fff; }
.btn-danger   { background: #b91c1c; color: #fff; }
.btn-warning  { background: #7c5c00; color: #f0a500; border-color: #f0a500; }
.btn-full     { width: 100%; }

.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.75rem; border-radius: 4px; }

/* ── Flash messages ──────────────────────────────────────────────────────────── */
.flash-messages {
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}
.flash {
  padding: 0.7rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid;
}
.flash-success { background: #0f2916; border-color: #2ea043; color: #a8f5b4; }
.flash-error   { background: #2d0b0b; border-color: #b91c1c; color: #fca5a5; }
.flash-info    { background: #0c2616; border-color: #2f9e44; color: #93e6a8; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-pending  { background: #2d2000; color: #f0a500; }
.badge-approved { background: #0f2916; color: #2ea043; }
.badge-rejected { background: #2d0b0b; color: #b91c1c; }
.badge-disabled { background: #1c1c1c; color: #6e7681; }
.badge-admin    { background: #0c2616; color: #2f9e44; }
.badge-active   { background: #0f2916; color: #2ea043; }
.badge-inactive { background: #1c1c1c; color: #6e7681; }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.4rem; font-weight: 700; flex: 1; }

/* ── Project dashboard grid ──────────────────────────────────────────────────── */
.project-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.project-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.1s;
}
.project-card:hover {
  border-color: #2f9e44;
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-slug { font-size: 0.7rem; color: #8b949e; letter-spacing: 0.08em; }
.project-name { font-size: 1.05rem; font-weight: 600; }
.project-desc { font-size: 0.8rem; color: #8b949e; line-height: 1.4; }
.project-cta  { font-size: 0.8rem; color: #2f9e44; margin-top: auto; padding-top: 0.75rem; }
.project-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 0.75rem; }
.project-btn {
  flex: 1;
  text-align: center;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #e6edf3;
  transition: border-color 0.15s, background 0.15s;
}
.project-btn:hover { background: #1f2937; border-color: #57d364; color: #57d364; text-decoration: none; }
.project-btn-docs { border-color: #2f9e44; color: #57d364; }
.project-btn-docs:hover { background: #2f9e4422; }

/* ── Project iframe viewer ───────────────────────────────────────────────────── */
/* Fill the viewport minus the 56px top nav. min-height:0 lets the flex child
   shrink correctly; the iframe fills via absolute positioning so its height
   never depends on percentage-height resolving through the flex chain (which
   some browsers, e.g. Edge, collapse to a tiny default height). */
.viewer-page { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 56px); min-height: 0; }
.viewer-header {
  padding: 0.6rem 1.25rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}
.viewer-breadcrumb { font-size: 0.82rem; color: #8b949e; }
.viewer-breadcrumb a { color: #8b949e; }
.viewer-breadcrumb a:hover { color: #e6edf3; }
.breadcrumb-sep { margin: 0 0.4rem; }
.viewer-frame-wrapper { flex: 1; overflow: hidden; position: relative; min-height: 0; }
.project-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table thead th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b949e;
  border-bottom: 1px solid #30363d;
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid #21262d;
  transition: background 0.1s;
}
.data-table tbody tr:hover { background: #161b22; }
.data-table td {
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.8rem; }
.ts   { font-size: 0.78rem; color: #8b949e; white-space: nowrap; }
.muted{ color: #8b949e; }
.desc-cell { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.url-cell  { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Audit table ─────────────────────────────────────────────────────────────── */
.audit-action {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  background: #21262d;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #c9d1d9;
}

/* ── Admin sections ─────────────────────────────────────────────────────────── */
.admin-section { margin-bottom: 2.5rem; }
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #21262d;
}

.create-form {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem;
  max-width: 700px;
}
.edit-form {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.5rem;
  min-width: 280px;
}

/* ── Filter bar (users page) ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-input {
  width: auto;
  min-width: 220px;
  flex: 1;
}
.filter-tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.filter-tab {
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 1px solid #30363d;
  border-radius: 20px;
  color: #8b949e;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab:hover { border-color: #8b949e; color: #e6edf3; }
.filter-tab.active { background: #21262d; border-color: #8b949e; color: #e6edf3; }

/* ── Inline forms / action cells ─────────────────────────────────────────────── */
.inline-form { display: inline; }
.action-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  min-width: 200px;
}
.grant-details { display: inline-block; position: relative; }
.grant-details summary { cursor: pointer; }
.grant-details summary::-webkit-details-marker { display: none; }

.select-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  border-radius: 4px;
  width: auto;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #e6edf3;
  margin-right: 0.25rem;
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: #8b949e;
  padding: 3rem 1rem;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.platform-footer {
  border-top: 1px solid #21262d;
  text-align: center;
  padding: 0.85rem;
  font-size: 0.75rem;
  color: #484f58;
}

/* ── Quality Knowledge Base ──────────────────────────────────────────────────── */
.kb-breadcrumb {
  font-size: 0.82rem;
  color: #8b949e;
  margin-bottom: 1rem;
}
.kb-breadcrumb a { color: #8b949e; }
.kb-breadcrumb a:hover { color: #e6edf3; }

.kb-category-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.kb-category-chip {
  padding: 0.35rem 0.85rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 20px;
  color: #e6edf3;
  font-size: 0.82rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.kb-category-chip:hover {
  border-color: #2f9e44;
  color: #57d364;
  text-decoration: none;
}

.kb-article-meta {
  font-size: 0.8rem;
  color: #8b949e;
  margin-bottom: 1.5rem;
}
.kb-article-body {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1.75rem 2rem;
  font-size: 0.95rem;
  line-height: 1.75;
  color: #e6edf3;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 820px;
}
