.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 2rem;
    margin: 0.313rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.3;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    min-width: 96px;
}

.btn-secondary {
    background: var(--bg-card, #ffffff);
    border-color: var(--border, #e3e1da);
    color: var(--text-primary, #1c2320);
}
.btn-secondary:hover { background: var(--bg-main, #f5f4f0); }

.btn-danger { background: var(--danger, #B83C3C); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }

.btn-success { background: var(--success, #2D7A3E); color: #fff; }
.btn-success:hover { filter: brightness(0.92); }

.btn-brown { background: var(--archive, #7C6A4E); color: #fff; }
.btn-brown:hover { filter: brightness(0.92); }

.btn-light {
    background: transparent;
    border-color: var(--border, #e3e1da);
    color: var(--text-secondary, #6b7570);
}
.btn-light:hover { background: var(--bg-main, #f5f4f0); }

.btn-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    opacity: 0.6;
}
.btn-close:hover { opacity: 1; background: var(--bg-main, #f5f4f0); }
.btn-close::before, .btn-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background: var(--text-primary, #1c2320);
}
.btn-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.btn-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border, #e3e1da);
    border-top-color: var(--accent, #11115C);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spin-icon { display: inline-block; animation: spin 0.9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show { display: flex; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 6, 0.5);
    z-index: 1045;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.modal-backdrop.show { opacity: 1; }

.modal-dialog {
    width: 100%;
    max-width: 500px;
    margin: auto;
    transform: translateY(-16px);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.modal.show .modal-dialog { transform: translateY(0); opacity: 1; }

.modal-dialog-scrollable .modal-content { max-height: 85vh; }
.modal-dialog-scrollable .modal-body { overflow-y: auto; }

.modal-lg { max-width: 700px; }

.modal-content {
    background: var(--bg-card, #ffffff);
    border-radius: 12px;
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,0.18));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border, #e3e1da);
}

.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary, #1c2320); }

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border, #e3e1da);
}

body.modal-open { overflow: hidden; }
