:root {
    --text-dark: #1c1c1e;
    --text-secondary: #6c757d;
    --background-light: #f2f2f7;
    --card-background: #ffffff;
    --border-color: #e5e5ea;
    --primary-blue: #007aff;
    --primary-red: #ff3b30;
    --primary-green: #34c759;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--background-light);
    color: var(--text-dark);
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", Helvetica, Arial, sans-serif;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    /* FIXED: Reduced top padding to match other pages */
    padding-top: 1rem; 
}

/* Title */
.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.main-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}
.main-title span { display: block; }
.back-link {
    width: 44px; height: 44px;
    background: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

/* Control Card */
.control-card {
    background: var(--card-background);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-bottom: 2rem;
}
.control-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Categories Management */
.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}
.category-tag {
    background: #eef1f5;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dark);
    transition: background-color 0.2s;
}
.category-delete-btn {
    background: #d1d1d6;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}
.category-delete-btn:hover { background: var(--primary-red); }

.add-category-row { 
    display: flex; 
    gap: 0.8rem; 
    align-items: center;
}
.add-category-row input {
    flex: 1;
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    background: #f9f9f9;
    -webkit-appearance: none;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}
.add-category-row input:focus {
    border-color: var(--primary-blue);
    background: white;
}


/* Form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}
.form-group input[type="text"], 
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    background: #f9f9f9;
    -webkit-appearance: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* File Input */
.file-input-wrapper {
    position: relative;
}
.file-label {
    display: block;
    padding: 0.8rem 1rem;
    background: #f9f9f9;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
}
.file-label:hover { background: #eef1f5; }
#achiev-icon { display: none; }

/* FIXED: Toggle Styling */
.form-group-inline-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    background: #f9f9f9;
    padding: 0.8rem 1rem;
    border-radius: 12px;
}
.form-group-inline-toggle label {
    margin-bottom: 0; /* Reset margin for flex alignment */
    flex-shrink: 1; /* Allow label text to shrink if needed */
}

.toggle-switch { 
    position: relative; 
    display: inline-block; 
    width: 51px; 
    height: 31px; 
    flex-shrink: 0; /* Prevent shrinking */
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 27px; width: 27px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--primary-green); }
input:checked + .slider:before { transform: translateX(20px); }

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--primary-blue); color: white; }
.btn-secondary { background: #e5e5ea; color: var(--text-dark); }
.btn-add { background: var(--primary-green); color: white; }

/* List Items */
.achiev-category-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.5rem 0.5rem;
    font-weight: 700;
}
.achiev-item {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.achiev-item.hidden-item {
    opacity: 0.6;
    background: #f2f2f2;
}
.achiev-icon-display {
    width: 50px;
    height: 50px;
    background: #f0f2f5;
    border-radius: 20px; /* Rounded 20px */
    padding: 8px;
    flex-shrink: 0;
}
.achiev-icon-display img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.achiev-info {
    flex-grow: 1;
}
.achiev-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}
.achiev-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.achiev-meta {
    font-size: 0.8rem;
    color: #aaa;
    font-family: monospace;
    margin-top: 0.3rem;
}
.achiev-actions {
    display: flex;
    gap: 0.5rem;
}
.btn-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: white;
}
.btn-edit { background: #f59e0b; }
.btn-delete { background: #ff3b30; }
.btn-icon svg { width: 18px; height: 18px; fill: currentColor; }