﻿:root {
    --bg: #f8f2ee;
    --surface: #fff9f6;
    --surface-strong: #f2e5dd;
    --text: #3d2f29;
    --muted: #7d675d;
    --accent: #8d6e63;
    --accent-soft: #bfa79b;
    --ok: #5d7a61;
    --err: #a85d58;
    --border: #e2d2c7;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: radial-gradient(circle at 10% 5%, #f4e6de 0, transparent 40%),
        radial-gradient(circle at 90% 0, #efe4da 0, transparent 35%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.bg-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
}

.bg-one {
    width: 220px;
    height: 220px;
    left: -50px;
    top: 60px;
    background: #ddc1b2;
}

.bg-two {
    width: 260px;
    height: 260px;
    right: -80px;
    top: 220px;
    background: #ceb2a4;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 980px;
    margin: 0 auto;
    padding: 1rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.app-title {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-chip {
    background: var(--surface-strong);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.app-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    background: rgba(255, 249, 246, 0.9);
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

.nav-link.active {
    background: var(--surface-strong);
    border-color: var(--accent-soft);
    font-weight: 600;
}

.page-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.8rem;
}

.card {
    background: rgba(255, 249, 246, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(6px);
}

.narrow {
    max-width: 460px;
    margin: 1rem auto;
}

.grid {
    display: grid;
    gap: 1rem;
}

.two-col {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

h2,
h3 {
    margin-top: 0;
}

.muted {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 0.75rem;
}

label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.92rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-row input {
    width: auto;
}

.btn {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    line-height: 1.2;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-outline {
    border-color: var(--accent-soft);
    color: var(--text);
    background: transparent;
}

.list {
    display: grid;
    gap: 0.7rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    background: #fff;
}

.list-item.static {
    align-items: flex-start;
}

.pill {
    background: var(--surface-strong);
    color: var(--text);
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th,
td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 0.5rem;
}

.flash-stack {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.flash {
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}

.flash-success {
    background: #e5efe7;
    color: var(--ok);
}

.flash-error {
    background: #f7e4e2;
    color: var(--err);
}

@media (max-width: 640px) {
    .container {
        padding: 0.75rem;
    }

    .app-title {
        font-size: 1rem;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-right {
        justify-content: space-between;
    }

    .app-nav {
        position: sticky;
        top: 0.5rem;
        z-index: 5;
    }
}

.w-full {
    width: 100%;
}

.diag-row-ok td { background: #edf4ee; }
.diag-row-warn td { background: #f7efe5; }
.diag-row-problem td { background: #f8e9e7; }
.status-badge { display: inline-block; border-radius: 999px; padding: 0.18rem 0.6rem; font-size: 0.8rem; border: 1px solid transparent; }
.status-ok { color: #4f6d56; background: #e5efe7; border-color: #c5d9c9; }
.status-warn { color: #7d6348; background: #f3e7d8; border-color: #e2cdb6; }
.status-problem { color: #8a5450; background: #f4dedd; border-color: #dfb8b5; }

.math-content {
    white-space: pre-wrap;
    line-height: 1.5;
}

.math-content mjx-container {
    margin: 0.25rem 0;
}

.material-image-frame {
    width: 100%;
    max-width: 360px;
    height: 220px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 0.4rem;
}

.material-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.inline-form select {
    min-width: 70px;
}

.table-wrap .btn,
.inline-form .btn {
    min-width: 170px;
}
@media (max-width: 640px) {
    .table-wrap .btn,
    .inline-form .btn {
        min-width: 140px;
    }
}


.table-wrap .btn,
.inline-form .btn {
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
}

