* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    margin: 0;
    background: #0f1115;
    color: #e8e8ec;
}

a { color: #6fb1ff; }

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: #1a1d24;
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 320px;
}

.login-box h1 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.login-box form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-box input {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.3rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #0f1115;
    color: #e8e8ec;
}

.login-box button {
    width: 100%;
    padding: 0.7rem;
    border-radius: 6px;
    border: none;
    background: #4c8bf5;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.error {
    color: #ff6b6b;
    font-size: 0.9rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #1a1d24;
}

main {
    padding: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.hint {
    margin-top: 2rem;
    padding: 1rem;
    background: #1a1d24;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #9a9aa5;
}

.class-list {
    list-style: none;
    padding: 0;
}

.class-list li {
    background: #1a1d24;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.tabnav {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem;
    background: #14161c;
    overflow-x: auto;
}

.tabnav a {
    display: inline-block;
    padding: 0.7rem 1rem;
    color: #9a9aa5;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tabnav a.active {
    color: #e8e8ec;
    border-bottom-color: #4c8bf5;
}

.success {
    color: #6fd88a;
    font-size: 0.9rem;
}

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

.inline-form input[type="text"],
.inline-form select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1d24;
    color: #e8e8ec;
}

.inline-form button {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    background: #4c8bf5;
    color: white;
    cursor: pointer;
}

.inline-form-tight {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    margin-right: 0.5rem;
}

.inline-form-tight select,
.inline-form-tight button {
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1d24;
    color: #e8e8ec;
    cursor: pointer;
    font-size: 0.8rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #2a2d34;
    font-size: 0.9rem;
}

.data-table th {
    color: #9a9aa5;
    font-weight: 600;
}

.plain-list {
    list-style: none;
    padding: 0;
}

.plain-list li {
    background: #1a1d24;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    background: #4c8bf5;
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.5rem;
}

.checkbox-row {
    display: block;
    padding: 0.4rem 0;
    font-size: 0.9rem;
}

.token-link {
    font-size: 0.75rem;
    background: #0f1115;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    word-break: break-all;
}

.hint-inline {
    font-size: 0.8rem;
    color: #9a9aa5;
}

.danger-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    background: #d9534f;
    color: white;
    cursor: pointer;
}

.phase-buttons {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.phase-btn-form {
    display: inline-block;
}

.phase-btn {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border: none;
    background: #1a1d24;
    color: #e8e8ec;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid #333;
}

.phase-btn:hover {
    border-color: #4c8bf5;
}

.search-box {
    width: 100%;
    max-width: 400px;
    padding: 0.6rem;
    margin: 1rem 0;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1d24;
    color: #e8e8ec;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.student-card {
    background: #1a1d24;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 0.8rem;
}

.student-card.unevaluated {
    border-color: #333;
}

.student-card.tendency--2 { border-color: #d9534f; }
.student-card.tendency--1 { border-color: #e08a5a; }
.student-card.tendency-0  { border-color: #6c6f7a; }
.student-card.tendency-1  { border-color: #7dc98f; }
.student-card.tendency-2  { border-color: #4cd964; }

.student-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.tendency-picker {
    display: flex;
    gap: 0.3rem;
}

.t-btn {
    flex: 1;
    padding: 0.5rem 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    color: white;
}

.t-neg2 { background: #d9534f; }
.t-neg1 { background: #e08a5a; }
.t-zero { background: #6c6f7a; }
.t-pos1 { background: #7dc98f; }
.t-pos2 { background: #4cd964; }

.editable-row {
    background: transparent !important;
    padding: 0 !important;
}

.rename-input {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #0f1115;
    color: #e8e8ec;
    min-width: 200px;
}

.wall-link {
    font-size: 0.85rem;
}

.wall-control {
    background: #14161c;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin: 1rem 0 1.5rem;
}

.wall-control h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
}

.wall-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.wall-btn-form {
    display: inline-block;
}

.wall-btn {
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    border: 1px solid #333;
    background: #1a1d24;
    color: #e8e8ec;
    cursor: pointer;
    font-size: 0.85rem;
}

.wall-btn.active {
    background: #4c8bf5;
    border-color: #4c8bf5;
    font-weight: 600;
}

.item-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    background: #14161c;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.item-form label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    gap: 0.3rem;
}

.item-form input[type="text"],
.item-form input[type="number"],
.item-form input[type="file"],
.item-form select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1d24;
    color: #e8e8ec;
}

.checkbox-inline {
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem !important;
}

.item-form button {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    background: #4c8bf5;
    color: white;
    cursor: pointer;
    height: fit-content;
}

.item-grid, .color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.item-card, .color-card {
    background: #1a1d24;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.item-preview {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.item-preview img {
    max-width: 70px;
    max-height: 70px;
}

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
}

.item-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.item-actions button {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #0f1115;
    color: #e8e8ec;
    cursor: pointer;
    font-size: 0.75rem;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
    margin: 1rem 0;
}

.emoji-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1a1d24;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 0.8rem 0.5rem;
    cursor: pointer;
    text-align: center;
    font-size: 0.75rem;
}

.emoji-tile input[type="checkbox"] {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
}

.emoji-tile:has(input:checked) {
    border-color: #4c8bf5;
    background: #1f2733;
}

.emoji-tile.emoji-imported {
    opacity: 0.4;
    cursor: not-allowed;
}

.emoji-char {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.emoji-name {
    color: #b8b8c2;
}
