/* ==========================================================================
   Creativity Jungle Beta Testing -- design system
   Single stylesheet, no framework. Tokens first, then layout, then components.
   ========================================================================== */

:root {
    --green-900: #0d3b1f;
    --green-800: #14532d;
    --green-700: #1a6b3a;
    --green-100: #dcfce7;
    --green-50:  #f0fdf4;

    --ink:       #1f2328;
    --ink-muted: #5b6470;
    --ink-faint: #8b949e;

    --surface:   #ffffff;
    --canvas:    #f4f5f7;
    --border:    #e3e5e8;
    --border-strong: #cfd4da;

    --amber-700: #92400e;
    --amber-100: #fef3c7;
    --red-700:   #b91c1c;
    --red-100:   #fee2e2;
    --blue-700:  #1d4ed8;
    --blue-100:  #dbeafe;
    --violet-700:#6d28d9;
    --violet-100:#ede9fe;
    --slate-700: #334155;
    --slate-100: #f1f5f9;

    --radius:    8px;
    --radius-sm: 5px;
    --shadow:    0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
    --shadow-lg: 0 4px 6px -1px rgba(16,24,40,.08), 0 10px 20px -4px rgba(16,24,40,.10);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: Consolas, Menlo, "SF Mono", monospace;
}

/* -- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.25; font-weight: 650; color: var(--green-900); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

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

hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

code, kbd { font-family: var(--mono); font-size: .9em; }

/* -- Layout --------------------------------------------------------------- */

.site-header {
    background: var(--green-800);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header .bar {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 58px;
    flex-wrap: wrap;
}

.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: 9px;
}
.brand:hover { text-decoration: none; opacity: .9; }
.brand .mark {
    background: var(--green-100);
    color: var(--green-900);
    width: 28px; height: 28px;
    border-radius: 6px;
    display: grid; place-items: center;
    font-size: .85rem; font-weight: 800;
}

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
    color: rgba(255,255,255,.86);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: .93rem;
    font-weight: 500;
}
.site-nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.site-nav a.active { background: rgba(255,255,255,.18); color: #fff; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-user { color: rgba(255,255,255,.8); font-size: .88rem; }

.site-main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.site-main.narrow { max-width: 780px; }

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-muted);
    font-size: .85rem;
}
.site-footer .bar {
    max-width: 1180px; margin: 0 auto; padding: 18px 20px;
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--ink-muted); margin: 0; }

/* -- Cards & panels ------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card > .card-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.card > .card-head h2, .card > .card-head h3 { margin: 0; font-size: 1.02rem; }
.card > .card-body { padding: 20px; }
.card > .card-foot {
    padding: 14px 20px; border-top: 1px solid var(--border);
    background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius);
    display: flex; gap: 10px; flex-wrap: wrap;
}

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Key-value pairs used across the admin detail pages. */
.kv { display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: 8px 18px; }
.kv dt { color: var(--ink-muted); font-size: .88rem; }
.kv dd { margin: 0; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 10px; } }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 1.9rem; font-weight: 700; color: var(--green-800); line-height: 1.1; }
.stat .label { color: var(--ink-muted); font-size: .85rem; margin-top: 2px; }
.stat.alert .num { color: var(--amber-700); }

/* -- Buttons -------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit; font-size: .93rem; font-weight: 600;
    cursor: pointer;
    background: var(--green-800); color: #fff;
    transition: background .12s ease, border-color .12s ease;
    text-decoration: none;
    line-height: 1.3;
}
.btn:hover { background: var(--green-900); color: #fff; text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }

.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--slate-100); color: var(--ink); }

.btn-danger { background: var(--red-700); }
.btn-danger:hover { background: #991b1b; }

.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--slate-100); color: var(--ink); }

.btn-sm { padding: 5px 11px; font-size: .85rem; }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* -- Forms ---------------------------------------------------------------- */

.form-group { margin-bottom: 18px; }
.form-group > label, .form-label {
    display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; color: var(--ink);
}
.form-hint { color: var(--ink-muted); font-size: .84rem; margin: 4px 0 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=url], input[type=search],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    font: inherit; font-size: .95rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(26,107,58,.14);
}
input[readonly], input:disabled, textarea:disabled, select:disabled {
    background: var(--slate-100); color: var(--ink-muted);
}
textarea { min-height: 110px; resize: vertical; }

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 9px; }
.check input[type=checkbox], .check input[type=radio] { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--green-800); }
.check label { font-weight: 400; margin: 0; cursor: pointer; }

.form-row { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.field-validation-error, .validation-summary-errors ul { color: var(--red-700); font-size: .86rem; }
.field-validation-error { display: block; margin-top: 4px; }
.validation-summary-errors {
    background: var(--red-100); border: 1px solid #fca5a5; color: var(--red-700);
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
}
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
input.input-validation-error, textarea.input-validation-error, select.input-validation-error {
    border-color: #ef4444;
}

/* -- Alerts --------------------------------------------------------------- */

.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    border: 1px solid transparent; margin-bottom: 18px; font-size: .93rem;
}
.alert-success { background: var(--green-100); border-color: #86efac; color: #14532d; }
.alert-error   { background: var(--red-100);   border-color: #fca5a5; color: var(--red-700); }
.alert-warning { background: var(--amber-100); border-color: #fcd34d; color: var(--amber-700); }
.alert-info    { background: var(--blue-100);  border-color: #93c5fd; color: var(--blue-700); }

/* -- Badges --------------------------------------------------------------- */

.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: .76rem; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
    background: var(--slate-100); color: var(--slate-700);
}
.badge-green  { background: var(--green-100);  color: var(--green-800); }
.badge-amber  { background: var(--amber-100);  color: var(--amber-700); }
.badge-red    { background: var(--red-100);    color: var(--red-700); }
.badge-blue   { background: var(--blue-100);   color: var(--blue-700); }
.badge-violet { background: var(--violet-100); color: var(--violet-700); }

/* -- Tables --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data thead th {
    background: #fafbfc; font-size: .78rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ink-muted); font-weight: 700; white-space: nowrap;
}
table.data tbody tr:hover { background: var(--green-50); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
    text-align: center; padding: 44px 20px; color: var(--ink-muted);
    background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty h3 { color: var(--ink-muted); }

/* -- Filter bar ----------------------------------------------------------- */

.filters {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px;
}
.filters .form-group { margin: 0; min-width: 160px; flex: 1 1 160px; }
.filters .form-group > label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); }

/* -- Project cards -------------------------------------------------------- */

.project-card { display: flex; flex-direction: column; }
.project-card .card-body { flex: 1; }
.project-card .meta { color: var(--ink-muted); font-size: .86rem; display: flex; gap: 14px; flex-wrap: wrap; }

/* -- Feedback board ------------------------------------------------------- */

.feedback-item {
    display: flex; gap: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.feedback-item.pinned { border-color: var(--green-700); border-left-width: 4px; }

.vote-box { flex: none; width: 62px; text-align: center; }
.vote-btn {
    width: 100%; padding: 7px 4px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); color: var(--ink-muted);
    font: inherit; font-size: .78rem; font-weight: 600; line-height: 1.2;
    transition: all .12s ease;
}
.vote-btn:hover:not(:disabled) { border-color: var(--green-700); color: var(--green-800); background: var(--green-50); }
.vote-btn:disabled { cursor: not-allowed; opacity: .6; }
.vote-btn.voted { background: var(--green-100); border-color: var(--green-700); color: var(--green-800); }
.vote-btn .count { display: block; font-size: 1.25rem; font-weight: 700; color: var(--green-800); }
.vote-btn.voted .count { color: var(--green-900); }

.feedback-main { flex: 1; min-width: 0; }
.feedback-main h3 { margin: 0 0 6px; font-size: 1.02rem; }
.feedback-main .excerpt { color: var(--ink-muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.feedback-meta {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    color: var(--ink-faint); font-size: .83rem;
}

.comment {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 12px; background: var(--surface);
}
.comment.admin { border-left: 4px solid var(--green-700); background: var(--green-50); }
.comment.internal { border-left: 4px solid var(--amber-700); background: #fffbeb; }
.comment .who { font-weight: 650; font-size: .9rem; }
.comment .when { color: var(--ink-faint); font-size: .82rem; }
.comment .body { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

.attachments { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.attachment {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 6px 11px; font-size: .85rem; background: var(--surface); color: var(--ink);
}
.attachment:hover { border-color: var(--green-700); text-decoration: none; }
.attachment-thumb {
    display: block; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    overflow: hidden; max-width: 190px;
}
.attachment-thumb img { display: block; width: 100%; height: auto; }

/* -- Rich text emitted by the admin editors ------------------------------- */

.rich { overflow-wrap: anywhere; }
.rich ul, .rich ol { padding-left: 22px; margin: 0 0 1em; }
.rich li { margin-bottom: .3em; }
.rich a { text-decoration: underline; }
.rich code { background: var(--slate-100); padding: 1px 5px; border-radius: 3px; }
.rich pre { background: var(--slate-100); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; }
.rich blockquote {
    margin: 0 0 1em; padding: 8px 14px;
    border-left: 3px solid var(--green-700); background: var(--green-50);
}
.rich img { max-width: 100%; height: auto; }

/* -- Question builder ----------------------------------------------------- */

.question-row {
    display: flex; gap: 14px; align-items: flex-start;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 10px; background: var(--surface);
}
.question-row .handle { color: var(--ink-faint); font-size: .8rem; padding-top: 4px; white-space: nowrap; }
.question-row .detail { flex: 1; min-width: 0; }
.question-row .detail .label-text { font-weight: 600; }

.option-list { margin: 6px 0 0; padding-left: 18px; color: var(--ink-muted); font-size: .88rem; }

/* -- Utilities ------------------------------------------------------------ */

.muted    { color: var(--ink-muted); }
.faint    { color: var(--ink-faint); }
.small    { font-size: .86rem; }
.strong   { font-weight: 650; }
.mono     { font-family: var(--mono); }
.nowrap   { white-space: nowrap; }
.right    { text-align: right; }
.center   { text-align: center; }
.mt-0 { margin-top: 0; }    .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }  .mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 26px; } .mb-3 { margin-bottom: 26px; }

.code-box {
    font-family: var(--mono); font-size: 1.05rem; letter-spacing: .5px;
    background: var(--slate-100); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 12px 14px; overflow-wrap: anywhere;
}

.divider-label {
    display: flex; align-items: center; gap: 12px;
    color: var(--ink-muted); font-size: .84rem; text-transform: uppercase;
    letter-spacing: .05em; font-weight: 700; margin: 26px 0 14px;
}
.divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.agreement-box {
    max-height: 220px; overflow-y: auto;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 14px 16px; background: #fafbfc; font-size: .9rem; margin-bottom: 12px;
}

/* Project blocks on the application form, revealed when a project is ticked. */
.project-questions {
    border-left: 3px solid var(--green-700);
    background: var(--green-50);
    padding: 16px 18px; margin: 10px 0 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.project-questions h4 { margin-bottom: 12px; color: var(--green-800); }
.project-questions .form-group:last-child { margin-bottom: 0; }

@media print { .site-header, .site-footer, .btn, .filters { display: none !important; } }
