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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #121212;
    color: #e0e0e0;
    min-height: 100vh;
}

/* Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}

.admin-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #66BB6A;
    letter-spacing: 2px;
}

.admin-badge {
    background: #2E7D32;
    color: #fff;
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 8px;
    letter-spacing: 1px;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user {
    color: #aaa;
    font-size: 0.85rem;
}

.btn-header {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #444;
    border-radius: 6px;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.btn-header:hover {
    background: #2d2d2d;
    border-color: #666;
}

.btn-logout {
    border-color: #d32f2f;
    color: #ef5350;
}

.btn-logout:hover {
    background: rgba(211, 47, 47, 0.15);
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 0;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    padding: 0 24px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #888;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #ccc;
}

.tab-btn.active {
    color: #66BB6A;
    border-bottom-color: #66BB6A;
}

/* Sub-tabs */
.sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.sub-tab-btn {
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-tab-btn.active {
    background: #2E7D32;
    border-color: #2E7D32;
    color: #fff;
}

/* Content */
.admin-content {
    padding: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 1.2rem;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.panel-desc {
    font-size: 0.8rem;
    color: #888;
}

/* Add row */
.add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-row-inline {
    margin-top: 8px;
    margin-bottom: 0;
}

.input-add {
    padding: 10px 14px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.85rem;
    outline: none;
    flex: 1;
    transition: border-color 0.2s;
}

.input-add:focus {
    border-color: #66BB6A;
}

.input-role {
    flex: 0 0 120px;
}

.input-small {
    flex: 1;
}

.btn-add {
    padding: 10px 20px;
    background: #2E7D32;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-add:hover {
    background: #1B5E20;
}

/* List items */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.list-item:hover {
    border-color: #555;
}

.item-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.item-role {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: rgba(46, 125, 50, 0.2);
    color: #66BB6A;
}

.role-user {
    background: rgba(100, 100, 100, 0.2);
    color: #aaa;
}

.account-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-delete {
    background: none;
    border: none;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.btn-delete:hover:not(:disabled) {
    color: #ef5350;
    background: rgba(211, 47, 47, 0.1);
}

.btn-delete:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-small {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-small:hover:not(:disabled) {
    background: #3d3d3d;
    border-color: #666;
}

.btn-small:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Materials groups */
.mat-group {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.mat-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mat-group-header h3 {
    font-size: 0.95rem;
    color: #66BB6A;
    font-weight: 600;
}

.mat-group-actions {
    display: flex;
    gap: 6px;
}

.mat-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.mat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 0.8rem;
}

.mat-item .btn-delete-item {
    background: none;
    border: none;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.2s;
}

.mat-item .btn-delete-item:hover {
    color: #ef5350;
}

.empty-msg {
    color: #666;
    font-size: 0.85rem;
    padding: 20px;
    text-align: center;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.toast-success {
    background: #2E7D32;
    color: #fff;
}

.toast-error {
    background: #c62828;
    color: #fff;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 900;
}

.modal-card {
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 24px 28px;
    min-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-card h3 {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.modal-card p {
    font-size: 0.85rem;
    color: #aaa;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-cancel {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid #444;
    border-radius: 8px;
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel:hover {
    background: #2d2d2d;
}

/* Messages */
.message-composer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    background: #1e1e1e;
    padding: 16px;
    border: 1px solid #333;
    border-radius: 10px;
}

.msg-textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.msg-send-btn {
    align-self: flex-end;
}

.messages-list {
    margin-top: 16px;
}

.msg-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.msg-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 120px;
}

.msg-date {
    font-size: 0.75rem;
    color: #888;
}

.msg-author {
    font-size: 0.75rem;
    color: #66BB6A;
    background: rgba(46, 125, 50, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}
