:root {
    --bg: #f4f5f9;
    --paper: #ffffff;
    --ink: #1d2433;
    --muted: #5a6272;
    --line: #d8dbe4;
    --accent: #0f7b6c;
    --danger: #b22f2f;
}

* {
    box-sizing: border-box;
}

body {
    color: var(--ink);
    background: radial-gradient(circle at top right, #d9efe9 0%, var(--bg) 30%, #eef0f7 100%);
}

.wrap {
    width: min(1120px, 94vw);
    margin: 0 auto;
}

.site-header {
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.header-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0;
}

h1 {
    font-size: 1.2rem;
    margin: 0;
}

h2, h3 {
    margin-top: 0;
}

nav a {
    text-decoration: none;
    color: var(--ink);
    margin-left: 1rem;
    font-weight: 600;
}

.nav-logout-btn {
    margin-left: 0.75rem;
    padding: 0.6rem 0.95rem;
    border-radius: 6px;
    background: var(--danger);
    color: #fff !important;
    transition: background-color 0.15s ease-in-out;
}

.nav-logout-btn:hover,
.nav-logout-btn:focus {
    background: #8d1f1f;
    color: #fff !important;
    text-decoration: none;
}

main.wrap {
    padding: 1rem 0 2rem;
}

.grid.two {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.card.narrow {
    width: min(500px, 95%);
    margin: 2rem auto;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.btn-link {
    text-decoration: none;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-link:hover,
.btn-link:focus {
    background: #0d6558;
    color: #fff;
    text-decoration: none;
    outline: none;
}

.btn-link-secondary {
    background: #4f5f7d;
}

.btn-link-secondary:hover,
.btn-link-secondary:focus {
    background: #3e4a5c;
    color: #fff;
    text-decoration: none;
    outline: none;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-weight: 600;
}

input, textarea, select, button {
    font: inherit;
}

input, textarea, select {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.55rem;
    background: #fff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button {
    border: none;
    border-radius: 6px;
    padding: 0.7rem 1rem;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.15s ease-in-out;
}

button:hover,
button:focus {
    background: #0d6558;
    outline: none;
}

button.secondary {
    background: #4f5f7d;
}

button.secondary:hover,
button.secondary:focus {
    background: #3e4a5c;
    outline: none;
}

button.danger, .text-danger {
    background: var(--danger);
    color: #fff;
}

button.danger:hover,
button.danger:focus {
    background: #8d1f1f;
    color: #fff;
    outline: none;
}

.muted {
    color: var(--muted);
    font-size: 0.93rem;
}

.alert {
    padding: 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.8rem;
}

.alert.success {
    background: #d9f3eb;
    color: #0f564b;
}

.alert.error {
    background: #f6dddd;
    color: #6a1f1f;
}

.simple-list {
    margin: 0;
    padding-left: 1.1rem;
}

.simple-list li {
    margin-bottom: 0.6rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 0.55rem;
    vertical-align: top;
}

th {
    text-align: left;
    background: #f7f8fc;
}

.client-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.7rem;
    margin-bottom: 0.8rem;
}

.row {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
    margin-left: 0;
    margin-right: 0;
}

.row > * {
    width: auto;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    flex: 0 0 auto;
}

.row > form {
    display: inline-flex;
    margin: 0;
}

.row > a {
    display: inline-flex;
    align-items: center;
}

.grow {
    flex: 1;
}

details {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 0.8rem;
    background: #fff;
}

summary {
    padding: 0.7rem;
    cursor: pointer;
    font-weight: 700;
    background: #f6f8fb;
}

.section-content {
    padding: 0.8rem;
}

.question-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.7rem;
    margin-bottom: 0.7rem;
}

.interview-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.section-save-button {
    margin-bottom: 0.35rem;
}

.custom-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.custom-question-header h4 {
    margin: 0;
}

.custom-question-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

.custom-question-list .custom-question-item:last-child {
    margin-bottom: 0;
}

.additional-custom-questions-card {
    margin-top: 1rem;
}

.badge {
    display: inline-block;
    font-size: 0.8rem;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    color: #1f2937;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    margin-left: 0.35rem;
}

.badge-status-empty {
    background: #4b5563;
    border-color: #4b5563;
    color: #ffffff;
}

.badge-status-progress {
    background: #d97706;
    border-color: #d97706;
    color: #ffffff;
}

.badge-status-complete {
    background: #15803d;
    border-color: #15803d;
    color: #ffffff;
}

@media (min-width: 1024px) {
    .card-title-row {
        align-items: flex-start;
    }

    .row {
        flex-wrap: nowrap;
    }

    .custom-question-header {
        flex-direction: row;
        align-items: center;
    }

    button,
    .btn-link {
        white-space: nowrap;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

    .card-title-row {
        flex-wrap: wrap;
    }

    .interview-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .custom-question-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 767px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

    .card-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .interview-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .row {
        width: 100%;
    }

    .row > form,
    .row > a {
        width: 100%;
    }

    .custom-question-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .custom-question-actions {
        flex-direction: column;
        align-items: stretch;
    }

    button,
    .btn-link,
    .row > a,
    .custom-question-actions button {
        width: 100%;
        justify-content: center;
    }

    .interview-actions button,
    .interview-actions .btn-link,
    .custom-question-header button {
        width: 100%;
        justify-content: center;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
