:root {
    --color-bg: #f7f5f1;
    --color-surface: #ffffff;
    --color-border: #e0dcd3;
    --color-text: #2b2521;
    --color-muted: #756b5e;
    --color-primary: #8a5a2b;
    --color-primary-dark: #6b4420;
    --color-success: #2f7d4f;
    --color-error: #b3392c;
    --color-gold: #b8860b;
    --color-silver: #6b7280;
    --color-bronze: #9a5b2c;
    --color-super-gold: #d4af1f;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--color-primary-dark);
    color: #fff;
    padding: 0.75rem 1rem;
}

.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.brand-logo {
    height: 40px;
    width: auto;
}
.brand span { font-weight: 400; opacity: 0.85; font-size: 0.9rem; display: block; }

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.nav a { color: #fff; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.user-chip {
    background: rgba(255,255,255,0.15);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.inline-form { display: inline; }
.link-button {
    background: none;
    border: none;
    color: var(--color-primary-dark);
    text-decoration: underline;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
}
.topbar .link-button { color: #fff; }

.flash {
    margin: 1rem auto 0;
    max-width: 1100px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}
.flash-success { background: #e3f3e8; color: var(--color-success); border: 1px solid #bfe3cb; }
.flash-error { background: #fbe7e4; color: var(--color-error); border: 1px solid #f2c5bd; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

h1, h2, h3 { color: var(--color-primary-dark); }

summary { cursor: pointer; font-weight: 600; color: var(--color-primary-dark); }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
}
th, td {
    text-align: left;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.95rem;
}
th { background: #f1ece4; }

.btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
}
.btn:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-muted); }
.btn-danger { background: var(--color-error); }
.btn-block { display: block; width: 100%; text-align: center; }

.document-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0 1.5rem;
}
.document-card-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: 0.7rem;
}
.document-card-body { flex: 1 1 auto; }
.document-card-body h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.document-card-meta { margin: 0 0 0.6rem; color: var(--color-muted); font-size: 0.9rem; }

.regulamin-sections { margin-top: 1.5rem; }
.regulamin-sections details {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
}
.regulamin-sections summary { list-style: none; }
.regulamin-sections summary::-webkit-details-marker { display: none; }
.regulamin-sections summary::before { content: "▸ "; }
.regulamin-sections details[open] summary::before { content: "▾ "; }
.regulamin-sections details > *:not(summary) { margin-top: 0.75rem; }
.regulamin-sections ol, .regulamin-sections ul { padding-left: 1.4rem; }
.regulamin-sections li { margin-bottom: 0.4rem; }
.regulamin-sections .faq-table th, .regulamin-sections .faq-table td { font-size: 0.9rem; }

.round-section > summary {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    list-style: none;
}
.round-section > summary::-webkit-details-marker { display: none; }
.round-section > summary::before { content: "▾ "; }
.round-section:not([open]) > summary::before { content: "▸ "; }
.round-section > summary .field-hint { font-size: 0.95rem; font-weight: 400; }

label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=date], select, textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: #fff;
    color: var(--color-text);
}
textarea { min-height: 6rem; }
.field-hint { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.2rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem 1.25rem;
}
@media (min-width: 720px) {
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-draft { background: #eee; color: #555; }
.status-submitted { background: #e3eefb; color: #29597d; }
.status-locked { background: #fdebd0; color: #8a5a2b; }
.status-withdrawn { background: #f3d9d4; color: var(--color-error); }
tr.row-dimmed { opacity: 0.5; }
.status-final { background: #fbe7e4; color: var(--color-error); }
.status-success { background: #e2f3e5; color: #2e7d32; }

.medal-gold { color: var(--color-gold); font-weight: 700; }
.medal-silver { color: var(--color-silver); font-weight: 700; }
.medal-bronze { color: var(--color-bronze); font-weight: 700; }
.medal-super_gold { color: var(--color-super-gold); font-weight: 700; text-shadow: 0 0 1px currentColor; }

.footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.85rem;
    padding: 2rem 1rem;
}

/* Lista probek sedziego - siatka kompaktowych kafelkow (nawet 50 probek na sedziego,
   wiec duze pojedyncze wiersze robily za duzo przewijania). */
.sample-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
}
.sample-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-decoration: none;
    color: var(--color-text);
    min-width: 0;
}
.sample-card:hover { border-color: var(--color-primary); }
.sample-card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.sample-card .num { font-size: 1.05rem; font-weight: 700; color: var(--color-primary-dark); }
.sample-card .sample-meta { line-height: 1.3; }

.sample-card-final {
    border: 2px solid var(--color-error);
    background: #fff8f7;
}

.weighted-total-chip {
    margin-top: 0.2rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}
.weighted-total-chip strong { font-size: 1.15rem; }
.weighted-total-chip-ok { background: #e3f3e8; color: var(--color-success); }
.weighted-total-chip-low { background: #fbe7e4; color: var(--color-error); }

#qr-reader-wrap { max-width: 480px; margin: 0 auto; }
#qr-video { width: 100%; border-radius: var(--radius); background: #000; }

@media (max-width: 480px) {
    .topbar { flex-direction: column; align-items: flex-start; }
}

/* Karta oceny sedziego - jeden wspolny "bloczek" z kryteriami (Smak/Konsystencja/Zgodnosc)
   ulozonymi pod soba. */
.criteria-block { margin-bottom: 0.75rem; }
.criterion-row + .criterion-row {
    border-top: 1px solid var(--color-border);
    margin-top: 0.9rem;
    padding-top: 0.9rem;
}
.criterion-row h3 {
    margin: 0 0 0.15rem;
    font-size: 1rem;
}
.criterion-row .field-hint {
    margin: 0 0 0.4rem;
}
.criterion-row input[type=number] {
    max-width: 8rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

/* Pole komentarza per kryterium jest tymczasowo ukryte na prosbe admina - patrz
   komentarz przy .criterion-comment-wrap w src/Views/judge/score_form.php. */
.criterion-comment-wrap { display: none; }

.weighted-total-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.55rem 0.85rem;
    margin: 0 0 0.75rem;
    font-size: 0.92rem;
}

.score-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-top: 0.75rem;
}
@media (min-width: 480px) {
    .score-actions { grid-template-columns: 1fr 1fr; }
}
.score-action { min-width: 0; }
.score-action .btn { width: 100%; text-align: center; }
.score-action .field-hint { margin-top: 0.35rem; text-align: center; }

.btn-success { background: var(--color-success); }
.btn-success:hover { background: #235e3f; }
